Opened 3 years ago
Last modified 4 months ago
#14206 reviewing enhancement
Custom taxonomy meta box callback
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Taxonomy | Version: | 3.0 |
| Severity: | trivial | Keywords: | has-patch |
| Cc: |
Description
I'd like to be able to specify my own meta box function for my custom taxonomies.
Currently if I want to specify my own meta box for my custom taxonomy, I must set the public parameter to false and then add my own meta box using add_meta_box(). It would be nice to just do this with a callback function parameter in register_taxonomy().
Example:
register_taxonomy( 'foo', 'bar', array(
'meta_box_callback' => 'my_meta_box'
) );
I'll write up a patch if there's a chance of it going in.
Attachments (1)
Change History (12)
- Keywords needs-patch added; dev-feedback removed
- Milestone changed from Awaiting Review to Future Release
- Keywords has-patch needs-testing 3.2-early added; needs-patch removed
- Keywords needs-testing 3.2-early removed
- Owner changed from garyc40 to scribu
- Severity changed from normal to trivial
- Status changed from assigned to reviewing
This can wait.
- Keywords close added
This appears to work for me in 3.5 out-of-the-box. Has the patch been silently added to the repo without updating this ticket?
- Keywords close removed
There is no code in 3.5 for handling the 'meta_box_callback' argument. You probably have a plugin installed or something.
comment:10
diddledan — 4 months ago
The name is different, but it appears that the same functionality is referenced in wp-includes/post.php around line 1178 and 1336
you're looking for 'register_meta_box_cb'
comment:11
scribu — 4 months ago
The idea was to pass the callback directly to register_taxonomy(), whereas 'register_meta_box_cb' is an argument you pass to register_post_type().

+1 on the idea.
Just to avoid confusion, in register_post_type() there's a 'register_meta_box_cb' argument which receives a callback. In that callback, you are supposed to call add_meta_box() or remove_meta_box(), as necessary.