Opened 3 years ago

Last modified 4 months ago

#14206 reviewing enhancement

Custom taxonomy meta box callback

Reported by: johnbillion Owned by: garyc40
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)

garyc40-14206.patch (1.6 KB) - added by garyc40 2 years ago.
there's a patch for that

Download all attachments as: .zip

Change History (12)

+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.

  • Keywords needs-patch added; dev-feedback removed
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to garyc40
  • Status changed from new to assigned

garyc402 years ago

there's a patch for that

  • 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.

  • Owner changed from scribu to garyc40
  • 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.

Related: #14877

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'

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().

Note: See TracTickets for help on using tickets.