Make WordPress Core

Changeset 61278


Ignore:
Timestamp:
11/22/2025 04:35:57 AM (3 weeks ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/meta-boxes.php

    r60805 r61278  
    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 );
     
    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:
     
    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 );
     
    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 );
Note: See TracChangeset for help on using the changeset viewer.