Hide Visibility Option From WordPress Publish Metabox

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

Leave a Comment