#14206 closed enhancement (fixed)
Custom taxonomy meta box callback
Reported by: | johnbillion | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | trivial | Version: | 3.0 |
Component: | Taxonomy | Keywords: | has-patch commit |
Focuses: | 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 (3)
Change History (26)
#2
@
14 years ago
- Keywords needs-patch added; dev-feedback removed
- Milestone changed from Awaiting Review to Future Release
#5
@
14 years ago
- 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.
#7
@
12 years ago
- 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?
#8
@
12 years ago
- 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.
#10
@
12 years 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'
#11
@
12 years 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().
#12
@
11 years ago
- Milestone changed from Future Release to 3.7
- Owner garyc40 deleted
Refreshed against trunk
#14
@
11 years ago
I'm hesitating a bit on this because of the difference between register_meta_box_cb and meta_box_callback. It is clear why the different functionality is needed — you may want to add a bunch of meta boxes for a single post type, while this is for replacing the taxonomy box — but the names are too similar. Explaining what register_meta_box_cb does is kind of awkward as it is.
I think we can solve this by clearly documenting the meta_box_callback parameter (missing from this patch) and seeing if the documentation for register_meta_box_cb can be improved as well.
#16
@
11 years ago
- Keywords needs-docs removed
14206.2.diff - refreshed, added and massaged some docs. Renamed it meta_box_cb
to parallel register_meta_box_cb
. I agree that they're similar, but perhaps keeping the same base of the name will indicate that they function differently on purpose.
#17
@
11 years ago
- Keywords commit added
- Owner set to nacin
nacin says he will test and get it in. Really, I just wanted to link to that chat log.
+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.