#43229 closed defect (bug) (fixed)
Documentation for add_meta_boxes hook is incorrect
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Options, Meta APIs | Keywords: | has-patch |
| Focuses: | docs | Cc: |
Description
The documentation for the add_meta_boxes hook states that the $post parameter is a WP_Post object. This is incorrect because the object can be any type. On the comment editing screen for example, this parameter is a WP_Comment object.
Attachments (1)
Change History (10)
#3
@
8 years ago
- Component changed from General to Options, Meta APIs
Sorry @SergeyBiryukov my comment overwrote the changes. I reverted back.
#4
in reply to:
↑ 2
;
follow-up:
↓ 5
@
8 years ago
Replying to danieltj:
The
add_meta_boxeshook doesn't have a parameter for a$post, at least not in function I found. Am I looking at the wrong one? I didn't see anything that referenced posts.
It's about the add_meta_boxes filter, not the add_meta_box() function :) There are 3 instances of the hook:
#5
in reply to:
↑ 4
@
8 years ago
Replying to SergeyBiryukov:
Replying to danieltj:
The
add_meta_boxeshook doesn't have a parameter for a$post, at least not in function I found. Am I looking at the wrong one? I didn't see anything that referenced posts.
It's about the
add_meta_boxesfilter, not theadd_meta_box()function :) There are 3 instances of the hook:
[...]
Ah, thank you for pointing that out. Was very confused when I saw the docs.
I'll take a look.
This ticket was mentioned in Slack in #core by danieltj. View the logs.
8 years ago
#7
@
8 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 5.0
The
add_meta_boxeshook doesn't have a parameter for a$post, at least not in function I found. Am I looking at the wrong one? I didn't see anything that referenced posts.Reference: https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/template.php#L886