I want to hide visibility option on publishbox for PAGE post_type like you see in red square on the below picture.
Thanks.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityAdd 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');