you can use parse_query
filter hook to exclude your pages using post__not_in attribute
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('21','22','23');
}
}
this will exclude pages with the ids of 21,22,23
and to make sure this pages will not be included on the front end using wp_list_pages
you can use wp_list_pages_excludes filter hook:
add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages');
function exclude_from_wp_list_pages($exclude_array){
$exclude_array = $exclude_array + array('21','22','23');
return $exclude_array;
}
Related Posts:
- Organizing Code in your WordPress Theme's functions.php File?
- Limit widget to certain sidebar?
- Highlight custom widgets in the admin area?
- Change the link of ‘Howdy’ at the top right
- Delete Post From front Page ( With Wp-admin restriction )
- Prevent from deleting any user role but subscriber
- Set “Display name publicly as” to be usernames by default
- Create custom fields as image uploads [duplicate]
- Is there a quick way to find out what posts haven’t been tagged?
- “WordPress installations is currently out of date” problem with difficult situation [closed]
- Add a custom field when adding / editing a page / post in admin panel
- How to Fix WordPress Not Saving Settings?
- Google flagged a wp-admin redirect as phishing
- Undeletable posts, users or other content
- Changing Admin Menu Labels
- Is there ANY way to remove comments function and section totally?
- Unit testing in the WordPress backend (is_admin() is true)
- How can I improve the line break handling in the WYSIWYG editor?
- How do I change the login logo URL and hover title?
- js error on post editing page
- How to add a custom metabox to the Menu Management admin screen?
- How to change the wording in wp-admin back-end?
- Creating my own Admin Forms in a WordPress CMS?
- How to make ajax call in wordpress in right way?
- Bulk Delete Users Error uri too large
- Remove “From computer” media tab for posts with existing attachments?
- Upgrade to SSL Breaks Admin Dashboard
- Disable slow media queries?
- Make sub menu items a main link in the admin menu using fuctions.php
- .htaccess rewrite rule for removing .php extension with exception of wp login and wp-admin
- Too many datadabse connections – upper ceiling mysql
- I can’t access my admin page after changing main url
- remove plugin admin menu in wordpress without installing plugin in v3.8.1
- Restrict categories to a custom post type
- From 403 error to 500 internal server error
- Only allow administrators and editors to access wp-admin
- Create a admin page in wordpress without admin menus (“wordpress sidebars”)
- Where are the admin notifications stored?
- How to sort comments in the “edit-comments.php” table based on a comment meta field?
- New wordpress install, what are the reasons the “Install Themes” tab is missing?
- Customise WordPress Update Notice in wp-admin backend area
- wp_comments table really big casuing /wp-admin/edit-comments.php to slowly load
- I get a 404 page on /wp-admin but not wp-login but as soon as I login I get a 404 again [closed]
- I want to disable login of admin (/wp-admin) with email and make it accessible only with username
- password reset link being sent as HTTP?
- Post.php is blocked by server? How to unblock? [closed]
- WP-Admin shows (1) update but there is no update for plugin, theme or WordPress
- Do I have to face security problems if I changing default role to Contributor
- Generate PDF using tcpdf from WordPress admin side custom page [closed]
- Editor’s role in WP
- Minimum version for WordPress Backbone
- I accidentally deleted an admin user and all their content is now gone from the site. [closed]
- Detect Featured Image remove while editing post in wp-admin (client-side)
- Cannot log in to the admin, no error message [closed]
- Need help for WordPress User Session Management?
- Create reviews and star-rating for user accounts in wp-admin [closed]
- Disable Admin CP authentication (or auto login)
- can’t access backend while frontend works perfect
- Admin top level menu, pointing to an external url
- How to add Extra Column of post Status in All post page
- Developer/Designer asking for admin access
- WordPress Child theme fails to override parent theme css
- How to change home page only in WordPress
- User Roles: How to hide a plugin from showing in WP-Admin?
- Too Many Redirects – WP-Admin Only
- Admin menu success message
- Pages section (only) not loading after publishing large number of pages
- Users can login to Website from wp-admin prior to confirmation email
- wp-admin 503 error
- Admin Page access
- Add HTML to custom post type edit page
- WP site after login keeps redirecting to looped url [closed]
- Locked out of site admin after change of URL
- WordPress Admin Login Issue
- Edit “Not Available” Page
- admin-ajax and external service interaction
- Add admin page to the top of the admin panel
- Admin page changes the $_POST data
- Remove menu item dashboard for a unique user
- Reestablishing Automatic and Secure FTP Connection, Primary Domain Change
- str_replace in wp-admin
- Admin area is not loading properly
- Changed the path to wp-login and now can’t access WPress dashboard
- Why my login panel has a wrong language?
- Using meta_query in add_query_arg
- Mixed content and expired session issues with SSL and wp-admin
- Limit access to wp-admin but still be able to log in from different locations?
- issue in wordpress auto delete post and redirect to another 1
- How to Filter in the “Add Media Popup” to show only “unattached” Media
- Working with post values in the admin panel
- wordpress login blank screen [closed]
- Child Plugin Admin Panel
- wp-admin blank page after admin login and all security off
- Can a wordpress admin see my failed Login attempts?
- After Upgrade: $user becomes unknown (id: 0) after successful login?
- Redirect users based on their roles, is_admin()
- insert an admin table inside another admin page
- /wp-admin/ – this link showing me “Index of /wp-admin”/ instead of dashboard
- What methods are you using to transfer individual WP site components from one site to another?
- how to Hide all products except the General Manager role in the WordPress admin panel?