From b0134e9632098a8f429524ed2436f469ba7dfbcb Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Tue, 18 Nov 2025 09:59:25 +0000 Subject: [PATCH 1/7] Update hook document to more accurately reflect the proper types --- src/wp-admin/includes/meta-boxes.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index c52b4787a3044..905d278a79cc3 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1677,8 +1677,10 @@ function register_and_do_post_meta_boxes( $post ) { * * @since 3.0.0 * - * @param string $post_type Post type. - * @param WP_Post $post Post object. + * @param string $post_type Post type of the current screen. Can be 'post', 'page', + * custom post types, 'comment', or 'link'. + * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on + * `$post_type`. */ do_action( 'add_meta_boxes', $post_type, $post ); From 223bed702150f44956e6a02f0544760bc1501eec Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Tue, 18 Nov 2025 10:09:46 +0000 Subject: [PATCH 2/7] Update hook documentation for add_meta_boxes_{} --- src/wp-admin/includes/meta-boxes.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 905d278a79cc3..232e21edb35c2 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1687,17 +1687,21 @@ function register_and_do_post_meta_boxes( $post ) { /** * Fires after all built-in meta boxes have been added, contextually for the given post type. * - * The dynamic portion of the hook name, `$post_type`, refers to the post type of the post. + * The dynamic portion of the hook name, `$post_type`, refers to the post type of the post, + * or the object type (comment, link). * * Possible hook names include: * * - `add_meta_boxes_post` * - `add_meta_boxes_page` * - `add_meta_boxes_attachment` + * - `add_meta_boxes_comment` + * - `add_meta_boxes_link` * * @since 3.0.0 * - * @param WP_Post $post Post object. + * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on + * the hook name. */ do_action( "add_meta_boxes_{$post_type}", $post ); From eb4c11d131abc04c4b8d0ef898422b89fa66e303 Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:06:33 +0000 Subject: [PATCH 3/7] Update spacing --- src/wp-admin/includes/meta-boxes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 232e21edb35c2..a0d51dc38ebd9 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1677,7 +1677,7 @@ function register_and_do_post_meta_boxes( $post ) { * * @since 3.0.0 * - * @param string $post_type Post type of the current screen. Can be 'post', 'page', + * @param string $post_type Post type of the current screen. Can be 'post', 'page', * custom post types, 'comment', or 'link'. * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on * `$post_type`. From 068c9b45e94917d42a0380c1057668be8af21d14 Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:26:09 +0000 Subject: [PATCH 4/7] Fix spacing --- src/wp-admin/includes/meta-boxes.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index a0d51dc38ebd9..3e8fc3dc7f297 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1678,9 +1678,9 @@ function register_and_do_post_meta_boxes( $post ) { * @since 3.0.0 * * @param string $post_type Post type of the current screen. Can be 'post', 'page', - * custom post types, 'comment', or 'link'. - * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on - * `$post_type`. + * custom post types, 'comment', or 'link'. + * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on + * `$post_type`. */ do_action( 'add_meta_boxes', $post_type, $post ); From 29e2289c3bb7d32596206c4a367149b98a395a14 Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Thu, 20 Nov 2025 17:46:48 +0000 Subject: [PATCH 5/7] Update hook variable names to be more generic --- src/wp-admin/includes/meta-boxes.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 3e8fc3dc7f297..0d88c68df0dd2 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1677,10 +1677,10 @@ function register_and_do_post_meta_boxes( $post ) { * * @since 3.0.0 * - * @param string $post_type Post type of the current screen. Can be 'post', 'page', - * custom post types, 'comment', or 'link'. - * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on - * `$post_type`. + * @param string $object_type The type of the current object that meta boxes were added to. + * Can be 'post', 'page', custom post types, 'comment', or 'link'. + * @param WP_Post|WP_Comment|object $object The post, comment, or link object. Type varies depending on + * `$post_type`. */ do_action( 'add_meta_boxes', $post_type, $post ); @@ -1700,8 +1700,8 @@ function register_and_do_post_meta_boxes( $post ) { * * @since 3.0.0 * - * @param WP_Post|WP_Comment|object $post The post, comment, or link object. Type varies depending on - * the hook name. + * @param WP_Post|WP_Comment|object $object The post, comment, or link object. Type varies depending on + * the hook name. */ do_action( "add_meta_boxes_{$post_type}", $post ); From ee6dc0b8450e2633150f972886fc00e5cf9c76ff Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:20:38 +0000 Subject: [PATCH 6/7] Update hook docs for add_meta_boxes --- src/wp-admin/includes/meta-boxes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 0d88c68df0dd2..3fcc1ff2e8f9e 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1680,7 +1680,7 @@ function register_and_do_post_meta_boxes( $post ) { * @param string $object_type The type of the current object that meta boxes were added to. * Can be 'post', 'page', custom post types, 'comment', or 'link'. * @param WP_Post|WP_Comment|object $object The post, comment, or link object. Type varies depending on - * `$post_type`. + * `$object_type`. */ do_action( 'add_meta_boxes', $post_type, $post ); From ca5aad94ea2eb4f289e9183acaa03868836dd8b9 Mon Sep 17 00:00:00 2001 From: Thomas Roberts <5656702+opr@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:46:00 +0000 Subject: [PATCH 7/7] Update hook docs for `do_meta_boxes` too --- src/wp-admin/includes/meta-boxes.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 3fcc1ff2e8f9e..52f43d0b685f4 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -1712,11 +1712,11 @@ function register_and_do_post_meta_boxes( $post ) { * * @since 3.0.0 * - * @param string $post_type Post type of the post on Edit Post screen, 'link' on Edit Link screen, - * 'dashboard' on Dashboard screen. - * @param string $context Meta box context. Possible values include 'normal', 'advanced', 'side'. - * @param WP_Post|object|string $post Post object on Edit Post screen, link object on Edit Link screen, - * an empty string on Dashboard screen. + * @param string $object_type Post type of the post on Edit Post screen, 'link' on Edit Link screen, + * 'dashboard' on Dashboard screen. + * @param string $context Meta box context. Possible values include 'normal', 'advanced', 'side'. + * @param WP_Post|object|string $object Post object on Edit Post screen, link object on Edit Link screen, + * an empty string on Dashboard screen. */ do_action( 'do_meta_boxes', $post_type, 'normal', $post ); /** This action is documented in wp-admin/includes/meta-boxes.php */