diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 89d7cd3acf..c652ae7cca 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -56,7 +56,7 @@ $core_actions_post = array( 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', - 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat' + 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'show-post-format-ui', ); // Register core Ajax calls. diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index 55107ae9af..1b07b3e5ba 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -3938,6 +3938,10 @@ body .ui-tooltip { padding-bottom: 0; } +.no-ui { + display: none; +} + .post-formats-fields { display: none; margin-bottom: 15px; diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 30fce330b2..d92e8c4b62 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -146,6 +146,15 @@ if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_ $post_format_set_class = ''; } + $user_wants = get_user_option( 'post_formats_' . $post_type ); + if ( false !== $user_wants ) { + // User wants what user gets. + $show_post_format_ui = (bool) $user_wants; + } else { + // UI is shown when the theme supports formats, or if the site has formats assigned to posts. + $show_post_format_ui = current_theme_supports( 'post-formats' ) || get_terms( 'post_format', array( 'number' => 1 ) ); + } + $format_class = " class='wp-format-{$post_format}'"; @@ -383,8 +392,10 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
-