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
- Administrator user cannot access dashboard after localwp import
- WordPress change role from administrator to author by itself (automatically)
- 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)
- Create page excerpts for landinpage
- Setting Default Screen Options
- Pageview all of sudden not working
- Childpage title + content on Parent Page
- Why my site scroll top when end load pages
- Issue with page not erasing
- WordPress Pages “allow comments” meta option can’t be checked
- Category Page Custom Layout [closed]
- My page won’t publish
- How to copy specific page content and create child page?
- Displaying Content Only in Certain Page IDs Not Working
- Content template when adding a new page
- How to output different content of page on different places in my template
- WordPress slow pages/post, hangs and white text
- WordPress white screen with “All Pages”
- Pages redirecting to homepage
- custom page or standalone page?
- Prevent page from displaying
- How to migrate .HTML pages to WordPress
- How to exclude sidebar from pages?
- Avada Theme – Display results from a specific category [closed]
- How to display time when page is created and edited
- Widget & storing a Select box choice
- Is it possible to restrict a specific user to edit a specific custom post.
- Restrict my pages from public
- Cannot add media to a page
- Separate Editing from Publishing for pages
- Call a function on every wordpress pages only
- Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)
- 1st Level Page with No Children
- Loading internal page
- How to Change the path of a child page?
- Firing page_publish where page is child page
- Echo page path suffix only – not the title, path or permalink
- Annoying notification when trying to create a new page
- Page stuttering on load
- Multiple pages to show posts
- Why does the default Insert/edit link function in Visual mode in posts or pages produce full urls?
- How to finish this loop?
- Previewing Draft shows white page, publishing works fine?
- How To List Sibling Pages And Include The Featured Image?
- Specify parent page template
- WP Template Hierarchy – Need help choosing the correct templates