#17515 closed defect (bug) (fixed)
Flaw in add_meta_box/do_meta_boxes
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.1.2 |
Component: | Inline Docs | Keywords: | has-patch 3.3-early commit needs-codex |
Focuses: | Cc: |
Description
There is a mysterious, undocumented 7th parameter in the add_meta_box() function, named $callback_args. This is to be an array of arguments that are passed into the callback function. The problem is that it the arguments are not passed into the callback function, but rather the whole $box object is instead. While I realize that one can access the arguments passed in via the $box object, I don't feel this is the proper method. I am attaching a patch to correctly pass the arguments.
Attachments (3)
Change History (12)
#2
@
14 years ago
- Keywords 3.3-early added
- Milestone changed from 3.2 to Future Release
Meta boxes will get new API in 3.3. Let's tidy this up then.
#3
@
12 years ago
- Milestone changed from Future Release to 3.6
template.php.diff completely breaks the admin. Converting the object to array doesn't make sense, and not having a second parameter to pass to the callback is the culprit. My patch just adds docs for the SEVENTH (7th) undocumented param for add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null )
#6
@
12 years ago
Can't do template.php.diff
— it's a breaking change. wonderboymusic's docs explanation still leaves me slightly confused. Attempting to re-work.
+1. I've been confused by this myself.
We should also document the argument, while we're at it.
PS: Please make patches relative to the root WP dir, as opposed to wp-admin/includes.