Hide other people posts except those in a specific category from the dashboard.
-
Hi guys,
I have the following code in my functions.php so users can only see their own posts. How do I amend this so that users will be able to see their own posts and others posts in a certain category.
function query_set_only_author( $wp_query ) { global $current_user; if ( is_admin() && !current_user_can('manage_options') ) { $wp_query->set( 'author', $current_user->ID ); } } add_action('pre_get_posts', 'query_set_only_author' );
- The topic ‘Hide other people posts except those in a specific category from the dashboard.’ is closed to new replies.