[wp-trac] [WordPress Trac] #21543: Add a show_metabox parameter to register_taxonomy

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 10 18:57:48 UTC 2012


#21543: Add a show_metabox parameter to register_taxonomy
-------------------------+------------------------------
 Reporter:  wycks        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Taxonomy     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------
Changes (by F J Kaiser):

 * cc: 24-7@… (added)


Comment:

 Maybe even easier:

 The {{{show_ui}}} argument comes in {{{~/wp-admin/menu.php}}} to add the
 admin menu entry and in {{{~/wp-admin/edit-form-advanced.php}}} to add the
 meta box.

 Currently both tests are against an expected boolean:

 {{{
 # ~/wp-admin/menu.php
 if (
     ! $tax->show_ui
     || ! in_array('post', (array) $tax->object_type, true)
 )
     # add menu entry

 # ~/wp-admin/edit-form-advanced.php
 if ( ! $taxonomy->show_ui )
     # add meta box
 }}}

 -------------------

 We could simply extend the test and check for a string value too:

 {{{
 # ~/wp-admin/menu.php
 if (
     ! $tax->show_ui
     || ! in_array('post', (array) $tax->object_type, true)
     || is_string( $taxonomy->show_ui ) AND 'admin_menu' ===
 $taxonomy->show_ui
 )
     # add menu entry

 # ~/wp-admin/edit-form-advanced.php
 if (
     ! $taxonomy->show_ui
     || is_string( $taxonomy->show_ui ) AND 'meta_box' ===
 $taxonomy->show_ui
 )
     # add meta box
 }}}

 This would be backwards compatible and allow showing in the menu or the
 meta box without major changes.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21543#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list