Make the Status, Visibility, or Date fields opened by default in the Publish box

By default, the Status, Visibility, and Date fields in the Publish metabox are closed, and you have to click Edit to show them.

Is there a way to make these fields visible by default?

Read More

The hidden elements all have a class of hide-if-js.

Related posts

Leave a Reply

2 comments

  1. This jQuery code seems to work, when added via the admin_footer hook.

    • #submitdiv = the whole Publish metabox
    • .misc-pub-section = each UI section (except the Publish and Save sections)
    • .hide-if-js = the fields that are hidden by default

      $('#submitdiv .misc-pub-section')
          .has("#post-status-display, #timestamp")
          .find('.hide-if-js')
          .toggle();
      

    That will unhide the Status dropdown and the Date picker.

  2. Building upon @supertrue ‘s answer, here is a full implementation.

    1./ Create a .js file (for ex: admin-post-ui-visibility.js) containing the following:

    (function($){
    
        $('#submitdiv .misc-pub-section')
            .has("#post-status-display, #timestamp")
            .find('.hide-if-js')
            .toggle();
    
    })(jQuery);
    

    2./ Add this to your Theme’s functions.php file:

    function reveal_visibility_metabox($hook){
        if( 'post.php' != $hook )
            return;
        wp_enqueue_script( 'reveal_visibility_metabox', get_stylesheet_directory_uri().'/library/js/admin-post-ui-visibility.js', array( 'jquery' ), '', true );
    }
    add_action( 'admin_enqueue_scripts', 'reveal_visibility_metabox' );