In a wordpress theme, when i get to appearance > menus i can see some default options to add to my menu (pages, posts, custom-links, etc) and custom post-types. I only need Custom Links to be shown. And I need it to come with the theme, so unchecking the boxes at "screen options" is not an option. I imagine there must be some code I need to add to the theme's functions.php. I was advised to try this:

add_filter( 'hidden_meta_boxes', 'custom_hidden_meta_boxes' );
function custom_hidden_meta_boxes( $hidden ) {
    $hidden[] = 'pages';
    return $hidden;

but it doesn't seem to work.

Does anyone have an idea how to do it?

1 Answer 1


You will able to remove nav menu meta-box links from screen option but if you want to remove by custom code, please try below code, simply copy and paste this into your functions.php file:

function custom_remove_menu_link_types() {
    global $wp_meta_boxes;
    foreach ($wp_meta_boxes['nav-menus']['side'] as $nav_menus) {
        foreach ($nav_menus as $nav_id => $nav_menu) {
            // remove all menu's and keep only one
            if ($nav_id !== 'add-custom-links') {
                remove_meta_box($nav_id, 'nav-menus', 'side');
add_action('admin_head-nav-menus.php', 'custom_remove_menu_link_types', 10);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.