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
- What methods to use to create small, editable pieces of text for static pages?
- Hide page visual editor if certain template is selected?
- Proper method to restrict non logged users into certain pages
- How to get the specific Page’s current ID and use it in a get_page function?
- foreach error on false boolean from get_terms
- How to get a feed for post type ‘page’?
- Export only pages and posts with mysql dump
- Hide everything on site for visitors except specific page IDs
- Visiting Webpage ONLY after another page was visited. Possible?
- How do I pass data from page content to the underlying PHP template
- Display page contain in index.php file
- How to redirect login and register pages
- Why do pages in WordPress have a hierarchy but menu’s also have a hierarchy?
- Custom page template with entirely different design. Is it possible in?
- Why does get_posts only show results for Admins or logged-out users?
- How to control who can view certain pages in BuddyPress? [closed]
- How to remove only pages from Admin Bar?
- Query specific Pages
- Phantom page can’t get rid of/can’t get at to change
- ‘x’ Converted to html code in example: 5×10
- How can I send an email when someone uses the HTML download Attribute?
- How to restrict an admin page, if the user is not superadmin?
- Later blog post pages give 404 error
- Different css file not working for the page template I created
- How to change the order of the Front Page so it doesn’t appear first
- 404.php only works if I’m logged in. Everybody else redirects to wp-login.php – why?
- Using index.php as page template
- What’s the section of code (or loop) which retrieves the Page title and description?
- define two login page url
- How to backup just pages from my site, but not posts with other post_type values
- Template field missing in page attributes
- How to hide a page in wordpress made for menu
- How to change default home link title?
- How do I restrict a second admin certain access?
- Pulling images from the media folder category to display inside a page
- Display grandchild page content on parent page
- Category Page Custom Layout [closed]
- How to copy specific page content and create child page?
- How to output different content of page on different places in my template
- WordPress slow pages/post, hangs and white text
- Previewing Draft shows white page, publishing works fine?
- Changing title bar in browser window of theme “Encounters Lite”
- Custom Filter using meta_value in wordpress admin list not working
- Pages redirect me to the homepage
- Dynamic content in pages
- Website fully loads then immediately crashes in Internet Explorer [closed]
- How to display a page?