Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

As the title says, I'd like to restrict back-end access to certain pages for certain users.

While doing a site with 45-50 pages, I realised it would be a much better user experience if the Page menu only listed those pages which the user should be able to change/update.

I've tried the plugins below to no avail. Advanced access manager has the functionality but does not work/is buggy on 3.5.1.

Code snippet in functions.php?

share|improve this question
You want to control access on a per-user basis? That is, you can't use Roles or Capabilities to do it? – s_ha_dum Mar 18 '13 at 14:27
Access/view based on Roles or Capabilities will work! – BoBoz Mar 18 '13 at 14:31
I should emphasize that the importent part is for the specified user/role not to see certain pages in back-end. As opposed to not be able to edit certain pages. – BoBoz Mar 18 '13 at 14:36

1 Answer 1

up vote 2 down vote accepted

This code seems to work well for me (in functions.php):

add_filter( 'parse_query', 'exclude_pages_from_admin' );

$user_id = get_current_user_id();

if ($user_id == 2) {
    function exclude_pages_from_admin($query) {
        global $pagenow,$post_type;
        if (is_admin() && $pagenow=='edit.php' && $post_type =='page') {
            $query->query_vars['post__not_in'] = array('123','234','345');
share|improve this answer
This is quite the nice answer, +1. Note that you can accept your own answers as correct... – Johannes Pille Sep 18 '14 at 3:10
Ok, this will be done :) – BoBoz Sep 18 '14 at 17:51

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.