Hide Pages in wp-admin according to certain user role
-
Good day
I’ve tried using this code to hide certain pages in ‘wp-admin > pages’ list for a “shop manager” (user role). It does not seem to work, could anyone please assist?
add_action( ‘pre_get_posts’ ,’exclude_this_page’ );
function exclude_this_page( $query ) {
if( !is_shop() )
return $query;
global $pagenow;
if( ‘edit.php’ == $pagenow && ( get_query_var(‘post_type’) && ‘page’ == get_query_var(‘post_type’) ) )
$query->set( ‘post__not_in’, array(13) ); // page id
return $query;
}Thank you ??
- The topic ‘Hide Pages in wp-admin according to certain user role’ is closed to new replies.