I want to hide specific pages for everyone in any part of WP dashboard, user role is not important. Help.

I have tried something like this:

add_filter('parse_query', 'hide_pages_in_wp_admin');
function hide_pages_in_wp_admin($query)
    global $post_type;
    if ($post_type == 'page') {
        $query->query_vars['post__not_in'] = array(6);

And this works, but only in Pages part of dashboard, example, In Menus part I can see that page...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.