Disable the visibility options in WP

Quick hack to get the job done, in case anyone else needs to do this:

add_action('add_meta_boxes', function() {
    add_action('admin_head', function() {
        echo <<<EOS
<style type="text/css">
#visibility {
    display: none;
}
</style>

EOS;
    });
});

add_action('restrict_manage_posts', function() {
    echo <<<EOS
<script type="text/javascript">
jQuery(document).ready(function($) {
    $("input[name="keep_private"]").parents("div.inline-edit-group:first").hide();
});
</script>

EOS;
});

(Still curious to know if there’s a better way.)

Leave a Comment