This code seems to work well for me (in functions.php):
$user_id = get_current_user_id();
if ($user_id == 2) {
add_filter( 'parse_query', 'exclude_pages_from_admin' );
}
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');
}
}
Related Posts:
- Restrict acceess of a page in backend
- remove/hide pages from users backend
- Check IF is a “single product page” and Check the “role” for a Redirect
- Create a “Dummy” parent page for a hierarchy in page listing?
- Only allow administrators and editors to access wp-admin
- Hide page visual editor if template is selected – redux
- Increment Page Order As Pages Are Created
- Only allow new subpages to be created
- Add custom admin menu item for pages using a certain template
- Too many pages causes WordPress admin to be unusable
- Hide Visibility Option From WordPress Publish Metabox
- Show different badge based upon the user role
- Backend option to include a javascript file on specific pages?
- How to make certain page templates visible to admin only
- User capability of create page/new page
- Only allow administrators and editors to access wp-admin
- WordPress Admin – Add Edit link to specific page under Pages Menu
- How to use the same code for multiple pages?
- Removing the TinyMCE editor for a given page template
- Restrict Author role to only 3 wp-admin pages
- Dash after page title
- List all private pages user has access rights to read
- Restricting Pages based on Hierarchy and User Role
- Role can edit just one page [closed]
- access control for assets in a website powered by wordpress
- Disable ADD PDF media button on rich text editor
- Can I “protect” a page with a form asking for an email address?
- Restrict the list of parent pages to only those which are created by current user
- How to disable delete option for a specific page? [closed]
- Need to create a custom page on a website
- How to exclude authors from get_pages()
- Order by modified date working in POSTS but not PAGES
- Allow a user to edit their own page and profile only
- Custom page only editable by one user
- Publish page by invoking submit via jQuery
- One author not showing in Author drop down list while editing page
- Is WordPress secure enough for a multi-user article directory?
- Translate dashboard metabox
- Custom user tables not working after migration
- Every change made by “Author” role is going to “pending review”
- Page and admin doesnt load – i tried everything
- Pages in wp-admin is not found 404
- Not allow add New Page for role ‘editor’
- How do I locate a third party page represented as a slug in my WordPress website?
- Customise the_title in admin area
- Creating content using wp-admin pages
- How to limit the pages shown in the page manager to those created by the logged in user?
- Add role and edit page capabilities
- Group Pages based on Parent in Admin Area
- disable trashability for certain pages
- Standard way of creating profile pages with custom content for each user?
- How to align bold,italic and underline in wp-admin?
- How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount
- Show only those pages that are created by the specific logged in user in WordPress
- Change the color of one or more specific items on the Pages list (Admin)
- How to give paged links custom title?
- Find empty pages or pages which have less than x characters
- Page template gives ‘Parse error: syntax error’ when used, but no error found!
- more tag in the $post->content when get_pages were used
- Different “Text Widgets” in Sidebar on Many Different Pages?
- How to ‘unpublish’ or ‘hide’ posts when user role changes?
- Guidelines for adding static pages
- Limit users by custom taxonomy and user roles
- How to echo excerpts with wp_list_pages?
- Remove pages from backend list *and* update counter accordingly
- How to call wp_list_comments() outside of the comments template?
- Using Pages to handle calls for custom post types
- Pages views limit [closed]
- Assigning certain authors to specific editors
- Where are $current_user->allcaps set?
- How to make my category archive behave like a page
- get_pages() as per custom menu order
- Display child pages in sidebar of parent page in wordpress
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- Adding a Calculator to a WordPress Page
- List all posts with the parent or grandparent of a page with a specified ID
- Page titles for internal classification of landing pages
- Function to incorporate an option in each Page
- How do I reference the front page’s parent Page object?
- How do i pick the pages in 20-11 header?
- Make Audio Element Persistent Across Pages
- How to remove a page in its entirety
- Why my home page doesnt work?
- Mailchimp RSS feed work with single wordpress page?
- How to publish pages under a subdomain url?
- how to setup subdomains for pages?
- How to approach need for virtual page on my WP site?
- change page status with code
- Attach link to pages accoding to tags
- Search Page: activate html code if the tag is on the page
- How to end the Page Load Event and load after that?
- Pages redirecting to homepage
- How to migrate .HTML pages to WordPress
- How do I make just one of my pages a Blog Page?
- How to show parent pages on a specific page if user is logged in?
- Create custom archive page for individual authors which is separate from the author.php page
- Display list of posts with x tag within a page?
- Forbid certain users to access a specific page
- display new WordPress page content
- Dashboard show only published pages instead of all pages