Support » Developing with WordPress » Hide pages from edit menu in Admin

  • I’m trying to add some code to a theme functions.php which will hide specific pages from the list of pages displayed in edit nav menus. We basically have a handful of pages that we don’t want the client to be able to add to any of the menus. Our code is below and we can use it to hide pages from the admin by changing the page title, but we can’t get it to hide the pages (ID’s listed) from the nav-menus.php. Can anyone help with fine-tuning please?

    add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ );
    function exclude_pages_from_admin($query) {
    global $pagenow,$post_type;
    if (is_admin() && $pagenow==’nav-menus.php’ && $post_type ==’page’) {
    $query->query_vars[‘post__not_in’] = array(‘1926′,’1940′,’1962′,’1966’);
    }
    }

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide pages from edit menu in Admin’ is closed to new replies.