
A WordPress plugin to hide posts from non-administrators by category.
| Author: | jrybacek (profile at wordpress.org) |
| WordPress version required: | 7.0 |
| WordPress version tested: | 7.1.5 |
| Plugin version: | 2.0.0 |
| Added to WordPress repository: | 21-12-2019 |
| Last updated: | 21-12-2019
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
| Rating, %: | 0 |
| Rated by: | 0 |
| Plugin URI: | https://github.com/jrybacek/hide-a-post/ |
| Total downloads: | 1 279 |

Click to start download
|
This plugin enables Editors to see only their content and categorized content. Uncategorized posts from Administrators do not show up for Editors.
Hide A Post Settings
Typed in the categories that I don’t want to have seen:
Awesome, Spicy
Example Posts (seen from Administrators)
- Tomato (Owner: Administrator, Categories: Fruit, Red)
- Potato (Owner: Administrator, Categories: Vegetable, White)
- Broccoli (Owner: Administrator, Categories: Vegetable, Green)
- Mushrooms (Owner: Administrator, Categories: Vegetable, White, Awesome) – This is a post, I want to hide from other non-Administrators based on the “Awesome” category.
- Apple (Owner: Administrator, Catgories: Fruit, Red)
- Pear (Owner: Administrator, Categories: Fruit, Green, Awesome) – This is a post, I want to hide from other non-Administrators based on the “Awesome” category.
- Peppers (Owner: Administrator, Categories: Vegetable, Green, Spicy) – This is a post, I want to hide from other non-Administrators based on the “Spicy” category.
- Peach (Owner: Administrator, Categories: Uncategorized) – I’ve just started creating this post as an Administrator
- Blueberries (Owner: Administrator, Categories: Fruit, Blue, Uncategorized) – Even thought I’ve started adding categories to this post, it won’t show up based on the “Uncategorized” category.
- Raspberries (Owner: Editor, Categories: Fruit, Red, Awesome) – Since I’m an administrator, I can still see this post, even though its in the “Awesome” category.
Example Posts (seen from Editors)
- Tomato (Owner: Administrator, Categories: Fruit, Red)
- Potato (Owner: Administrator, Categories: Vegetable, White)
- Broccoli (Owner: Administrator, Categories: Vegetable, Green)
- Apple (Owner: Administrator, Catgories: Fruit, Red)
- Raspberries (Owner: Editor, Categories: Fruit, Red, Awesome) – Since I’m an administrator, I can still see this post, even though its in the “Awesome” category.
About the plugin
We wanted to use WordPress with our tabletop gaming group. This enables us to all collaborate on content creation, while enabling the dungeon master to retain some “secrets”.
Screenshots

Posts as an Administrator

Posts as an Editor

Hide A Post settings page
FAQ
Why did you create this?
To avoid installing 15 different plugins just to hide posts by category from non-Administrators.
Does this plugin work with WP-CLI?
Yes. Starting in 2.0.0, Hide A Post safely handles WP-CLI’s scoped loader and bypasses post filtering for unauthenticated WP-CLI commands (such as wp post list). Passing --user=<editor> to WP-CLI applies non-Administrator filtering as expected.
What is hidden, and what is not?
Hidden posts are removed from post lists, search, feeds, sitemaps, archives, previous/next links, menus, the REST API, oEmbed, and wp-admin, and their comments are hidden too. Where a hidden post is referenced by ID, non-Administrators see the title “(Private post)”. Post counts are not adjusted: category counts and the “All (N)” totals in wp-admin still include hidden posts. Selecting a parent category does not hide posts that are only in its child categories. Pages and custom post types are never hidden.
Can developers change who sees hidden posts?
Yes. Use the hap_user_can_view_hidden_posts filter to grant or deny access per user, hap_hide_admin_default_category_posts to turn off the default-category rule, and hap_administrator_ids to change whose default-category posts are hidden.
How can I support Hide A Post?
Through Buy Me a Coffee or PayPal.
ChangeLog
2.0.0
- Modernized plugin architecture for WordPress 7.0+ (tested up to 7.1) and PHP 7.4–8.5.
- Fixed fatal
TypeError crash when listing posts via WP-CLI.
- Replaced comma-separated category text input with hierarchical category checkboxes on the settings screen.
- Replaced hardcoded
wp_ table prefixes and raw SQL interpolation with dynamic $wpdb table names, qualified columns, and parameterized NOT EXISTS queries via $wpdb->prepare().
- Blocked direct access to hidden posts by ID: capabilities (
map_meta_cap, including WP_Post arguments), REST API reads of posts and their sub-resources (404 before the endpoint runs), revisions, oEmbed, old-slug redirects, and canonical/404 slug-guess redirects.
- Hid comments on hidden posts from comment queries, the REST API, the comments feed, and Recent Comments, and closed new comments on them.
- Filtered classic menus and Navigation blocks, including nested submenus and REST
menu-items and wp_navigation responses, so links to hidden posts are not shown to non-Administrators (stored menus are not changed).
- Redacted hidden post titles read by ID (such as Media Library parent labels) to “(Private post)” for non-Administrators.
- Blocked the per-post comments admin screen (
edit-comments.php?p=) for hidden posts.
- Scoped Empty Trash to the posts the current user can see.
- Blocked non-Administrators from deleting hidden categories, including through bulk category deletion.
- Linked attachments of hidden posts by
?attachment_id= so the parent post’s slug is not exposed.
- Excluded hidden posts from previous/next post links,
wp_get_archives(), and get_posts() calls that use suppress_filters.
- Treated every user with the
manage_options capability (plus Super Admins on Multisite) as an Administrator for the default-category rule.
- Removed deleted categories from the saved settings automatically.
- Added the
hap_user_can_view_hidden_posts, hap_should_filter_query, hap_hide_admin_default_category_posts, and hap_administrator_ids filters.
- Added PHPUnit integration tests (single site and Multisite) to CI.
- Replaced deprecated
screen_icon() and role-name capability checks with modern Settings API markup and manage_options capability checks.
- Moved option cleanup from deactivation hook to
uninstall.php so deactivating the plugin preserves saved settings.
- Used WordPress’s
default_category option instead of hardcoding the English string “Uncategorized”.
1.1
- Enhanced code to allow for more than one administrator.
- Improved SQL statements.
- Fixed bug with duplicate posts being displayed.
1.0