0

enter image description here

Hi, For some specialized design, i have to remove Page PostType by my theme (for some reasons) Now i want to hide Page select section in Menus page in wp-admin. ( that section in attached image)

I searched for it but i didn't find and Function code for hide it.

0

You can actually hide Pages (and Posts, Custom Links, or Categories) using the Screen Options tab at the top of the Wordpress Dashboard while on the Menus editor screen. Just open that Screen Options tab and uncheck the box corresponding to Pages.

If you want to make sure that option never gets checked again, you could then use the following code to prevent users with restricted roles from accessing the Screen Options tab:

function remove_screen_options_tab() {
    return current_user_can( 'manage_options' );
}
add_filter('screen_options_show_screen', 'remove_screen_options_tab');

Alternatively, you could add custom CSS to the Wordpress dashboard to hide that specific class:

add_action('admin_head', 'wpse271824_custom_css');

function wpse271824_custom_css() {
  echo '<style>
    .nav-menu-meta #add-post-type-page {
       display: none;
    }
    .metabox-prefs label[for=add-post-type-page-hide] {
       display: none;
    }
  </style>';
}
  • Thanks Mate. yeah i know about that option for hide pages in Menus, but in this case i want force it hide to all other admins in my website . Alternate code (Adding Style) is Best choice. – Masih Dindar Jun 30 '17 at 8:39

Your Answer

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

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