WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '13 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 '13 at 16:02
It's not about viewing the page on the front-end but just about the back-end. – luke Jul 16 '13 at 16:03
You need to adapt this. – brasofilo Jul 16 '13 at 16:08
Thanks! This worked. I will post my answer asap. – luke Jul 16 '13 at 16:34
up vote 0 down vote accepted

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;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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