Removing Metabox for “Slug” without removing functionality

The box which allows slug edition under the post title is actually tied to the slug metabox. It needs it to work. So, removing the metabox will break it.

The only solution, I think, would be to use javascript or css to hide it. Something like this will work:

function hide_slug_box() {
    global $post;
    global $pagenow;
    if (is_admin() && $pagenow=='post-new.php' OR $pagenow=='post.php') {
        echo "<script type="text/javascript">
            jQuery(document).ready(function($) {
                jQuery('#edit-slug-box').hide();
            });
            </script>
        ";
    }
}
add_action( 'admin_head', 'hide_slug_box'  );

Leave a Comment