0

I want to hide visibility option on publishbox for PAGE post_type like you see in red square on the below picture.

enter image description here

Thanks.

1 Answer 1

1

Add this code:

function wpseNoVisibility() {
  echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</style>';
}
add_action('admin_head', 'wpseNoVisibility');

to functions.php of your active theme.

Needless to say, the preferred method, would be to add above code to functions.php of the child theme.

Update

Unfortunately, the above solution will not limit this change to pages only. We'll have to determine, if we add, or edit page, first. The following code will fix it:

function wpseNoVisibility() {
  echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</style>';
}

function wpseCurrentScreenAction($current_screen) {
    if ('page' == $current_screen->post_type && 'post' == $current_screen->base) {
        add_action('admin_head', 'wpseNoVisibility');
    }
}
add_action('current_screen', 'wpseCurrentScreenAction');

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.