Support » Networking WordPress » Hide Pages in Admin by Title/Slug

  • Resolved Erwin

    (@baksteen)


    For a multisite I am looking to hide a couple of pages that each subsite will have which I don’t want to be visible/editable. I found how to hide pages by ID with the following bit:

    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');
        }
    }

    But since it only works by ID it would only work on existing sites, yet I want to hide pages that are automatically created on new sites. So I want to know if it’s possible to hide pages by title or slug.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide Pages in Admin by Title/Slug’ is closed to new replies.