Changeset 44214 for trunk/src/wp-admin/edit-form-advanced.php
- Timestamp:
- 12/16/2018 01:18:22 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-admin/edit-form-advanced.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43837
- Property svn:mergeinfo changed
-
trunk/src/wp-admin/edit-form-advanced.php
r44132 r44214 244 244 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); 245 245 246 247 $publish_callback_args = array( '__back_compat_meta_box' => true ); 248 if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' != $post->post_status ) { 249 $revisions = wp_get_post_revisions( $post_ID ); 250 251 // We should aim to show the revisions meta box only when there are revisions. 252 if ( count( $revisions ) > 1 ) { 253 reset( $revisions ); // Reset pointer for key() 254 $publish_callback_args = array( 255 'revisions_count' => count( $revisions ), 256 'revision_id' => key( $revisions ), 257 '__back_compat_meta_box' => true, 258 ); 259 add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 260 } 261 } 262 263 if ( 'attachment' == $post_type ) { 264 wp_enqueue_script( 'image-edit' ); 265 wp_enqueue_style( 'imgareaselect' ); 266 add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); 267 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); 268 269 if ( wp_attachment_is( 'audio', $post ) ) { 270 add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 271 } 272 } else { 273 add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); 274 } 275 276 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { 277 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); 278 } 279 280 // all taxonomies 281 foreach ( get_object_taxonomies( $post ) as $tax_name ) { 282 $taxonomy = get_taxonomy( $tax_name ); 283 if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { 284 continue; 285 } 286 287 $label = $taxonomy->labels->name; 288 289 if ( ! is_taxonomy_hierarchical( $tax_name ) ) { 290 $tax_meta_box_id = 'tagsdiv-' . $tax_name; 291 } else { 292 $tax_meta_box_id = $tax_name . 'div'; 293 } 294 295 add_meta_box( 296 $tax_meta_box_id, 297 $label, 298 $taxonomy->meta_box_cb, 299 null, 300 'side', 301 'core', 302 array( 303 'taxonomy' => $tax_name, 304 '__back_compat_meta_box' => true, 305 ) 306 ); 307 } 308 309 if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) { 310 add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); 311 } 312 313 if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { 314 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 ) ); 315 } 316 317 if ( post_type_supports( $post_type, 'excerpt' ) ) { 318 add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 319 } 320 321 if ( post_type_supports( $post_type, 'trackbacks' ) ) { 322 add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 323 } 324 325 if ( post_type_supports( $post_type, 'custom-fields' ) ) { 326 add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 327 } 328 329 /** 330 * Fires in the middle of built-in meta box registration. 331 * 332 * @since 2.1.0 333 * @deprecated 3.7.0 Use 'add_meta_boxes' instead. 334 * 335 * @param WP_Post $post Post object. 336 */ 337 do_action( 'dbx_post_advanced', $post ); 338 339 // Allow the Discussion meta box to show up if the post type supports comments, 340 // or if comments or pings are open. 341 if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { 342 add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 343 } 344 345 $stati = get_post_stati( array( 'public' => true ) ); 346 if ( empty( $stati ) ) { 347 $stati = array( 'publish' ); 348 } 349 $stati[] = 'private'; 350 351 if ( in_array( get_post_status( $post ), $stati ) ) { 352 // If the post type support comments, or the post has comments, allow the 353 // Comments meta box. 354 if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { 355 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 356 } 357 } 358 359 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { 360 add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 361 } 362 363 if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { 364 add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 365 } 366 367 /** 368 * Fires after all built-in meta boxes have been added. 369 * 370 * @since 3.0.0 371 * 372 * @param string $post_type Post type for posts, 'comment' for comments, 373 * 'link' for links. 374 * @param WP_Post|WP_Comment|object $post Post, comment, or link object. 375 */ 376 do_action( 'add_meta_boxes', $post_type, $post ); 377 378 /** 379 * Fires after all built-in meta boxes have been added, contextually for the given post type. 380 * 381 * The dynamic portion of the hook, `$post_type`, refers to the post type of the post. 382 * 383 * @since 3.0.0 384 * 385 * @param WP_Post $post Post object. 386 */ 387 do_action( "add_meta_boxes_{$post_type}", $post ); 388 389 /** 390 * Fires after meta boxes have been added. 391 * 392 * Fires once for each of the default meta box contexts: normal, advanced, and side. 393 * 394 * @since 3.0.0 395 * 396 * @param string $post_type Post type for posts, 'dashboard' for dashboard widgets, 397 * 'link' for links. 398 * @param string $context Meta box context. Accepts 'normal', 'advanced', 'side'. 399 * @param WP_Post|string|object $post Post object for posts, empty string for dashboard widgets, 400 * link object for links. 401 */ 402 do_action( 'do_meta_boxes', $post_type, 'normal', $post ); 403 /** This action is documented in wp-admin/edit-form-advanced.php */ 404 do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); 405 /** This action is documented in wp-admin/edit-form-advanced.php */ 406 do_action( 'do_meta_boxes', $post_type, 'side', $post ); 246 register_and_do_post_meta_boxes( $post ); 407 247 408 248 add_screen_option(
Note: See TracChangeset
for help on using the changeset viewer.