1

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?

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

1
  • You can figure out their respective containers' id using any DOM inspector and set their visibility in CSS file or using jQuery.
    – Max Yudin
    Commented Feb 19, 2013 at 20:34

2 Answers 2

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.