-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Update add_meta_boxes hook documentation to more accurately reflect the proper types
#10527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
b0134e9
223bed7
eb4c11d
068c9b4
29e2289
ee6dc0b
ca5aad9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1677,25 +1677,31 @@ 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'. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This description isn't lined up with the one above it. Could you adjust it so it matches, and also check the line below for the same? Thanks!
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, thanks 🙈 phpcs wasn't sniffing that one for some reason. Done! |
||
| * @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 ); | ||
|
|
||
| /** | ||
| * 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 ); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about
$object_type?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I like the idea. Would you expect the variable passed to the hook to be renamed too, or just renamed in the documentation?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example:
renaming the actual variable passed would require it throughout the file, or creating a new variable just before firing the hook.
I don't mind assigning to a new variable, but not keen on renaming through the whole file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just renaming the variable in the hook docs. There shouldn't be a need to change any PHP variable names or add new variables.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I also applied similar changes to
do_meta_boxesin ca5aad9