#17515 closed defect (bug) (fixed)
Flaw in add_meta_box/do_meta_boxes
| Reported by: | jfarthing84 | Owned by: | markjaquith |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Inline Docs | Version: | 3.1.2 |
| Severity: | normal | Keywords: | has-patch 3.3-early commit needs-codex |
| Cc: | Focuses: |
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
@
15 years ago
- Keywords 3.3-early added
- Milestone 3.2 → Future Release
Meta boxes will get new API in 3.3. Let's tidy this up then.
#3
@
14 years ago
- Milestone Future Release → 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 )
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
+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.