diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 9e8da8588d..11077d1e2b 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -225,141 +225,7 @@ $post_type_object = get_post_type_object($post_type);
// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
-
-$publish_callback_args = array( '__back_compat_meta_box' => true );
-if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
- $revisions = wp_get_post_revisions( $post_ID );
-
- // We should aim to show the revisions meta box only when there are revisions.
- if ( count( $revisions ) > 1 ) {
- reset( $revisions ); // Reset pointer for key()
- $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ), '__back_compat_meta_box' => true );
- add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
- }
-}
-
-if ( 'attachment' == $post_type ) {
- wp_enqueue_script( 'image-edit' );
- wp_enqueue_style( 'imgareaselect' );
- add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
- add_action( 'edit_form_after_title', 'edit_form_image_editor' );
-
- if ( wp_attachment_is( 'audio', $post ) ) {
- add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
- }
-} else {
- add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
-}
-
-if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
- add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
-
-// all taxonomies
-foreach ( get_object_taxonomies( $post ) as $tax_name ) {
- $taxonomy = get_taxonomy( $tax_name );
- if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb )
- continue;
-
- $label = $taxonomy->labels->name;
-
- if ( ! is_taxonomy_hierarchical( $tax_name ) )
- $tax_meta_box_id = 'tagsdiv-' . $tax_name;
- else
- $tax_meta_box_id = $tax_name . 'div';
-
- add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name, '__back_compat_meta_box' => true ) );
-}
-
-if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) {
- add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
-}
-
-if ( $thumbnail_support && current_user_can( 'upload_files' ) )
- add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) );
-
-if ( post_type_supports($post_type, 'excerpt') )
- add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
-
-if ( post_type_supports($post_type, 'trackbacks') )
- add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
-
-if ( post_type_supports($post_type, 'custom-fields') )
- add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
-
-/**
- * Fires in the middle of built-in meta box registration.
- *
- * @since 2.1.0
- * @deprecated 3.7.0 Use 'add_meta_boxes' instead.
- *
- * @param WP_Post $post Post object.
- */
-do_action( 'dbx_post_advanced', $post );
-
-// Allow the Discussion meta box to show up if the post type supports comments,
-// or if comments or pings are open.
-if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
- add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
-}
-
-$stati = get_post_stati( array( 'public' => true ) );
-if ( empty( $stati ) ) {
- $stati = array( 'publish' );
-}
-$stati[] = 'private';
-
-if ( in_array( get_post_status( $post ), $stati ) ) {
- // If the post type support comments, or the post has comments, allow the
- // Comments meta box.
- if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
- add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
- }
-}
-
-if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
- add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
-
-if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
- add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
-}
-
-/**
- * Fires after all built-in meta boxes have been added.
- *
- * @since 3.0.0
- *
- * @param string $post_type Post type.
- * @param WP_Post $post Post object.
- */
-do_action( 'add_meta_boxes', $post_type, $post );
-
-/**
- * Fires after all built-in meta boxes have been added, contextually for the given post type.
- *
- * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
- *
- * @since 3.0.0
- *
- * @param WP_Post $post Post object.
- */
-do_action( "add_meta_boxes_{$post_type}", $post );
-
-/**
- * Fires after meta boxes have been added.
- *
- * Fires once for each of the default meta box contexts: normal, advanced, and side.
- *
- * @since 3.0.0
- *
- * @param string $post_type Post type of the post.
- * @param string $context string Meta box context.
- * @param WP_Post $post Post object.
- */
-do_action( 'do_meta_boxes', $post_type, 'normal', $post );
-/** This action is documented in wp-admin/edit-form-advanced.php */
-do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
-/** This action is documented in wp-admin/edit-form-advanced.php */
-do_action( 'do_meta_boxes', $post_type, 'side', $post );
+register_and_do_post_meta_boxes( $post );
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php
index b3deab00d9..f242b48eb9 100644
--- a/wp-admin/edit-form-blocks.php
+++ b/wp-admin/edit-form-blocks.php
@@ -368,6 +368,14 @@ wp_enqueue_style( 'wp-edit-post' );
*/
do_action( 'enqueue_block_editor_assets' );
+// In order to duplicate classic meta box behaviour, we need to run the classic meta box actions.
+require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
+register_and_do_post_meta_boxes( $post );
+
+// Some meta boxes hook into the 'edit_form_advanced' filter.
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'edit_form_advanced', $post );
+
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php
index 651ff15bab..613412d151 100644
--- a/wp-admin/edit-form-comment.php
+++ b/wp-admin/edit-form-comment.php
@@ -177,7 +177,7 @@ endif; ?>
2, 'default' => 2) );
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index fa1d2ffad4..fa658bb5b1 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -122,10 +122,10 @@ function wp_dashboard_setup() {
exit;
}
- /** This action is documented in wp-admin/edit-form-advanced.php */
+ /** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
- /** This action is documented in wp-admin/edit-form-advanced.php */
+ /** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'do_meta_boxes', $screen->id, 'side', '' );
}
diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index a8cfd161d7..15593684c6 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -1282,3 +1282,159 @@ function attachment_id3_data_meta_box( $post ) {
post_type;
+ $post_type_object = get_post_type_object( $post_type );
+
+ $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
+ if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
+ if ( wp_attachment_is( 'audio', $post ) ) {
+ $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
+ } elseif ( wp_attachment_is( 'video', $post ) ) {
+ $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
+ }
+ }
+
+ $publish_callback_args = array( '__back_compat_meta_box' => true );
+ if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
+ $revisions = wp_get_post_revisions( $post->ID );
+
+ // We should aim to show the revisions meta box only when there are revisions.
+ if ( count( $revisions ) > 1 ) {
+ reset( $revisions ); // Reset pointer for key()
+ $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ), '__back_compat_meta_box' => true );
+ add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+ }
+ }
+
+ if ( 'attachment' == $post_type ) {
+ wp_enqueue_script( 'image-edit' );
+ wp_enqueue_style( 'imgareaselect' );
+ add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
+ add_action( 'edit_form_after_title', 'edit_form_image_editor' );
+
+ if ( wp_attachment_is( 'audio', $post ) ) {
+ add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+ }
+ } else {
+ add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
+ }
+
+ if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
+ add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
+
+ // all taxonomies
+ foreach ( get_object_taxonomies( $post ) as $tax_name ) {
+ $taxonomy = get_taxonomy( $tax_name );
+ if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb )
+ continue;
+
+ $label = $taxonomy->labels->name;
+
+ if ( ! is_taxonomy_hierarchical( $tax_name ) )
+ $tax_meta_box_id = 'tagsdiv-' . $tax_name;
+ else
+ $tax_meta_box_id = $tax_name . 'div';
+
+ add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name, '__back_compat_meta_box' => true ) );
+ }
+
+ if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) {
+ add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
+ }
+
+ if ( $thumbnail_support && current_user_can( 'upload_files' ) )
+ add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) );
+
+ if ( post_type_supports($post_type, 'excerpt') )
+ add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+
+ if ( post_type_supports($post_type, 'trackbacks') )
+ add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+
+ if ( post_type_supports($post_type, 'custom-fields') )
+ add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+
+ /**
+ * Fires in the middle of built-in meta box registration.
+ *
+ * @since 2.1.0
+ * @deprecated 3.7.0 Use 'add_meta_boxes' instead.
+ *
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'dbx_post_advanced', $post );
+
+ // Allow the Discussion meta box to show up if the post type supports comments,
+ // or if comments or pings are open.
+ if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
+ add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+ }
+
+ $stati = get_post_stati( array( 'public' => true ) );
+ if ( empty( $stati ) ) {
+ $stati = array( 'publish' );
+ }
+ $stati[] = 'private';
+
+ if ( in_array( get_post_status( $post ), $stati ) ) {
+ // If the post type support comments, or the post has comments, allow the
+ // Comments meta box.
+ if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
+ add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+ }
+ }
+
+ if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
+ add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+
+ if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+ add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
+ }
+
+ /**
+ * Fires after all built-in meta boxes have been added.
+ *
+ * @since 3.0.0
+ *
+ * @param string $post_type Post type.
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'add_meta_boxes', $post_type, $post );
+
+ /**
+ * Fires after all built-in meta boxes have been added, contextually for the given post type.
+ *
+ * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
+ *
+ * @since 3.0.0
+ *
+ * @param WP_Post $post Post object.
+ */
+ do_action( "add_meta_boxes_{$post_type}", $post );
+
+ /**
+ * Fires after meta boxes have been added.
+ *
+ * Fires once for each of the default meta box contexts: normal, advanced, and side.
+ *
+ * @since 3.0.0
+ *
+ * @param string $post_type Post type of the post.
+ * @param string $context string Meta box context.
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'do_meta_boxes', $post_type, 'normal', $post );
+ /** This action is documented in wp-admin/includes/meta-boxes.php */
+ do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
+ /** This action is documented in wp-admin/includes/meta-boxes.php */
+ do_action( 'do_meta_boxes', $post_type, 'side', $post );
+}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index bbb7885de0..6127a576e4 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
-$wp_version = '5.0-beta1-43836';
+$wp_version = '5.0-beta1-43837';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.