Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function exclude_pages_from_admin_by_slug ($query) {
- global $pagenow,$post_type;
- //set the array of to be excluded slugs
- $excludeds = array(
- 'login',
- 'logout',
- 'lostpassword',
- 'register',
- 'resetpass'
- );
- //get array of IDs from array of slugs
- foreach ( $excludeds as $excluded ) {
- $excluded_IDs[] = get_page_by_path( $excluded )->ID;
- }
- if (!is_admin() && $pagenow=='edit.php' && $post_type =='page') {
- //exclude those IDs from query
- $query->query_vars['post__not_in'] = $excluded_IDs;
- }
- }
- add_filter( 'parse_query', 'exclude_pages_from_admin_by_slug' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement