#10: implement support for protecting posts with category-based recursive restriction#12
Open
michaeltech wants to merge 5 commits intoFloAppsLtd:masterfrom
Open
Conversation
michaeltech
commented
Apr 21, 2026
- extend protection logic to support posts
- implement recursive restriction via categories and subcategories
- keep feature optional via filter (no UI changes)
- align behavior with existing page protection
…rsive restriction - extend protection logic to support posts - implement recursive restriction via categories and subcategories - keep feature optional via filter (no UI changes) - align behavior with existing page protection
jrajamaki
requested changes
Apr 28, 2026
| if ( $term instanceof WP_Term && ! is_wp_error( $term ) ) { | ||
| $all[] = (int) $term->term_id; | ||
| } | ||
| $children = get_term_children( $root_id, 'category' ); |
Contributor
There was a problem hiding this comment.
@michaeltech - rather than looping over children one by one, would it possible to fetch them in single query to prevent N+1 queries?
Contributor
There was a problem hiding this comment.
@michaeltech - after further research, this isn't actually N+1 query problem because of WP's own caching mechanism. These changes could be reverted, sorry for trouble.
27ce995 to
49a2c3a
Compare
Author
|
Thank you for your feedback. |
jrajamaki
requested changes
May 6, 2026
| if ( ! is_array( $not_in ) ) { | ||
| $not_in = array(); | ||
| } | ||
| $existing_not_in = array_map( 'intval', $not_in ); |
Contributor
There was a problem hiding this comment.
@michaeltech - there could separate function for this piece of code, since there's another almost identical logic in floauth_get_extranet_restricted_category_term_ids function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.