I want to create a page which is only for editable and readable (within wp-admin) for administrators. To restrict other users to edit any page (and not only the own ones) is not the solution as I want them to have this capability.

I am using the plugin called "Access" by wp-types.

  • 1
    What have you tried so far? Where did it go wrong? Is there code you can add to your question that may clarify what you're asking for?
    – Pat J
    Jul 16, 2013 at 15:48
  • I want some specific pages to be only editable and readable by administrators but no other user roles. Reason is I have some pages which only content is shortcode for a plugin or it is just a dummy page which uses a custom page template with some static content. I don't want users (except administrators) to edit or even read this page because this might be confusing for them. I tried to restrict default users to edit any page (and not only the own ones) but this can not the solution as I want them to have the capability to do so for some other reasons.
    – luke
    Jul 16, 2013 at 16:02
  • It's not about viewing the page on the front-end but just about the back-end.
    – luke
    Jul 16, 2013 at 16:03
  • 1
    You need to adapt this.
    – brasofilo
    Jul 16, 2013 at 16:08

1 Answer 1


Thanks brasofilo!

add_action( 'pre_get_posts', 'hide_pages_to_user_except_admins' );
function hide_pages_to_user_except_admins( $query ) {
if( !is_admin() )
    return $query;
global $pagenow;   
$pages = array('201','38','99'); //page ids
    'edit.php' == $pagenow 
    && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) 
    $query->set( 'post__not_in', $pages );

return $query;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.