<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44214] trunk/src/wp-admin: Block Editor: Fix meta boxes not showing.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44214">44214</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44214","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jeremyfelt</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-12-16 01:18:22 +0000 (Sun, 16 Dec 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Block Editor: Fix meta boxes not showing.

The block editor needs to duplicate the classic meta box behaviour, so it can extract the registered meta boxes, and import them into the block editor.

To match the classic editor behaviour as closely as possible, this moves the relevant code from the classic editor, into a new function, so it can be called by both.

Merges <a href="https://core.trac.wordpress.org/changeset/43837">[43837]</a> from the 5.0 branch to trunk.

Props pento, peterwilsoncc.
Fixes <a href="https://core.trac.wordpress.org/ticket/45172">#45172</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmineditformadvancedphp">trunk/src/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunksrcwpadmineditformblocksphp">trunk/src/wp-admin/edit-form-blocks.php</a></li>
<li><a href="#trunksrcwpadmineditformcommentphp">trunk/src/wp-admin/edit-form-comment.php</a></li>
<li><a href="#trunksrcwpadmineditlinkformphp">trunk/src/wp-admin/edit-link-form.php</a></li>
<li><a href="#trunksrcwpadminincludesdashboardphp">trunk/src/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunksrcwpadminincludesmetaboxesphp">trunk/src/wp-admin/includes/meta-boxes.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunk">trunk/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk        2018-12-15 20:20:44 UTC (rev 44213)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk 2018-12-16 01:18:22 UTC (rev 44214)
</ins><a id="trunk"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557,43622
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43821,43825,43828,43830-43834,43836,43838-43843,43846-43848,43859-43860,43869-43876,43892,43898-43899,43904,43909,43912,43926-43929,43954,43956,43961-43963,44014,44017
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43848,43859-43860,43869-43876,43892,43898-43899,43904,43909,43912,43926-43929,43954,43956,43961-43963,44014,44017
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpadmineditformadvancedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/edit-form-advanced.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/edit-form-advanced.php 2018-12-15 20:20:44 UTC (rev 44213)
+++ trunk/src/wp-admin/edit-form-advanced.php   2018-12-16 01:18:22 UTC (rev 44214)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -243,168 +243,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
</span><span class="cx" style="display: block; padding: 0 10px"> require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+register_and_do_post_meta_boxes( $post );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$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 for posts, 'comment' for comments,
- *                                             'link' for links.
- * @param WP_Post|WP_Comment|object $post      Post, comment, or link 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 for posts, 'dashboard' for dashboard widgets,
- *                                         'link' for links.
- * @param string                $context   Meta box context. Accepts 'normal', 'advanced', 'side'.
- * @param WP_Post|string|object $post      Post object for posts, empty string for dashboard widgets,
- *                                         link object for links.
- */
-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 );
-
</del><span class="cx" style="display: block; padding: 0 10px"> add_screen_option(
</span><span class="cx" style="display: block; padding: 0 10px">        'layout_columns',
</span><span class="cx" style="display: block; padding: 0 10px">        array(
</span></span></pre></div>
<a id="trunksrcwpadmineditformblocksphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/edit-form-blocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/edit-form-blocks.php   2018-12-15 20:20:44 UTC (rev 44213)
+++ trunk/src/wp-admin/edit-form-blocks.php     2018-12-16 01:18:22 UTC (rev 44214)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -363,6 +363,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'enqueue_block_editor_assets' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// 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 );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once( ABSPATH . 'wp-admin/admin-header.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpadmineditformcommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/edit-form-comment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/edit-form-comment.php  2018-12-15 20:20:44 UTC (rev 44213)
+++ trunk/src/wp-admin/edit-form-comment.php    2018-12-16 01:18:22 UTC (rev 44214)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -195,7 +195,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="postbox-container-2" class="postbox-container">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'add_meta_boxes', 'comment', $comment );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpadmineditlinkformphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/edit-link-form.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/edit-link-form.php     2018-12-15 20:20:44 UTC (rev 44213)
+++ trunk/src/wp-admin/edit-link-form.php       2018-12-16 01:18:22 UTC (rev 44214)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,7 +31,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_meta_box( 'linkxfndiv', __( 'Link Relationship (XFN)' ), 'link_xfn_meta_box', null, 'normal', 'core' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_meta_box( 'linkadvanceddiv', __( 'Advanced' ), 'link_advanced_meta_box', null, 'normal', 'core' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'add_meta_boxes', 'link', $link );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,11 +43,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'add_meta_boxes_link', $link );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'do_meta_boxes', 'link', 'normal', $link );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'do_meta_boxes', 'link', 'advanced', $link );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px"> do_action( 'do_meta_boxes', 'link', 'side', $link );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> add_screen_option(
</span></span></pre></div>
<a id="trunksrcwpadminincludesdashboardphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/dashboard.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/dashboard.php 2018-12-15 20:20:44 UTC (rev 44213)
+++ trunk/src/wp-admin/includes/dashboard.php   2018-12-16 01:18:22 UTC (rev 44214)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -132,10 +132,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                exit;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px">         do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /** This action is documented in wp-admin/edit-form-advanced.php */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** This action is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx" style="display: block; padding: 0 10px">         do_action( 'do_meta_boxes', $screen->id, 'side', '' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/meta-boxes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/meta-boxes.php        2018-12-15 20:20:44 UTC (rev 44213)
+++ trunk/src/wp-admin/includes/meta-boxes.php  2018-12-16 01:18:22 UTC (rev 44214)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1363,3 +1363,182 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <?php
</span><span class="cx" style="display: block; padding: 0 10px">        endforeach;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Registers the default post meta boxes, and runs the `do_meta_boxes` actions.
+ *
+ * @since 5.0.0
+ *
+ * @param WP_Post $post The post object that these meta boxes are being generated for.
+ */
+function register_and_do_post_meta_boxes( $post ) {
+       $post_type        = $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 );
+}
</ins></span></pre>
</div>
</div>

</body>
</html>