Skip to content

Commit 095b5ed

Browse files
committed
Docs: Update meta box action documentation to more accurately reflect the possible object types.
In addition to a meta box being able to be added for a post, it can also be added for a comment or a link, or even nothing at all when on the Dashboard. Props opr18, nikunj8866, soyebsalar01, westonruter. See #64224. Fixes #64251. git-svn-id: https://develop.svn.wordpress.org/trunk@61278 602fd350-edb4-49c9-b593-d223f7449a82
1 parent cd5a897 commit 095b5ed

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/wp-admin/includes/meta-boxes.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,25 +1677,31 @@ function register_and_do_post_meta_boxes( $post ) {
16771677
*
16781678
* @since 3.0.0
16791679
*
1680-
* @param string $post_type Post type.
1681-
* @param WP_Post $post Post object.
1680+
* @param string $object_type The type of the current object that meta boxes were added to.
1681+
* Can be 'post', 'page', custom post types, 'comment', or 'link'.
1682+
* @param WP_Post|WP_Comment|object $object The post, comment, or link object. Type varies depending on
1683+
* `$object_type`.
16821684
*/
16831685
do_action( 'add_meta_boxes', $post_type, $post );
16841686

16851687
/**
16861688
* Fires after all built-in meta boxes have been added, contextually for the given post type.
16871689
*
1688-
* The dynamic portion of the hook name, `$post_type`, refers to the post type of the post.
1690+
* The dynamic portion of the hook name, `$post_type`, refers to the post type of the post,
1691+
* or the object type (comment, link).
16891692
*
16901693
* Possible hook names include:
16911694
*
16921695
* - `add_meta_boxes_post`
16931696
* - `add_meta_boxes_page`
16941697
* - `add_meta_boxes_attachment`
1698+
* - `add_meta_boxes_comment`
1699+
* - `add_meta_boxes_link`
16951700
*
16961701
* @since 3.0.0
16971702
*
1698-
* @param WP_Post $post Post object.
1703+
* @param WP_Post|WP_Comment|object $object The post, comment, or link object. Type varies depending on
1704+
* the hook name.
16991705
*/
17001706
do_action( "add_meta_boxes_{$post_type}", $post );
17011707

@@ -1706,11 +1712,11 @@ function register_and_do_post_meta_boxes( $post ) {
17061712
*
17071713
* @since 3.0.0
17081714
*
1709-
* @param string $post_type Post type of the post on Edit Post screen, 'link' on Edit Link screen,
1710-
* 'dashboard' on Dashboard screen.
1711-
* @param string $context Meta box context. Possible values include 'normal', 'advanced', 'side'.
1712-
* @param WP_Post|object|string $post Post object on Edit Post screen, link object on Edit Link screen,
1713-
* an empty string on Dashboard screen.
1715+
* @param string $object_type Post type of the post on Edit Post screen, 'link' on Edit Link screen,
1716+
* 'dashboard' on Dashboard screen.
1717+
* @param string $context Meta box context. Possible values include 'normal', 'advanced', 'side'.
1718+
* @param WP_Post|object|string $object Post object on Edit Post screen, link object on Edit Link screen,
1719+
* an empty string on Dashboard screen.
17141720
*/
17151721
do_action( 'do_meta_boxes', $post_type, 'normal', $post );
17161722
/** This action is documented in wp-admin/includes/meta-boxes.php */

0 commit comments

Comments
 (0)