#21543 closed enhancement (fixed)
Add a show_metabox parameter to register_taxonomy
Reported by: | wycks | Owned by: | helen |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
Currently when registering a taxonomy we have the $show_ui
param, this effects both the admin menu and the actual taxonomy meta box on the post edit screens.
There are cases when you want it to show in one but not the other, to do that now you have to use either remove_meta_box
or remove_menu_page
.
It would be nice to add another parameter like show_metabox => array(posts)
to register_taxonomy
which would effect the meta boxes only. And one for the admin menu as well.
related: #12718
Attachments (5)
Change History (21)
#4
follow-up:
↓ 5
@
12 years ago
- Cc xoodrew@… added
- Keywords has-patch 2nd-opinion added
I'm not sure this constitutes 'major changes' but took a stab at a different option in 21543.diff. Taking a cue from how rewrite
was handled in register_post_type()
, I allowed public
to accept either a boolean or array. And it's backward compatible, so either of these works:
'public' => true
or
'public' => array( 'admin_menu' => false, 'meta_box' => true )
The indexes also default to true if not set.
I'd appreciate some feedback on whether there's a more elegant way to go about it.
#5
in reply to:
↑ 4
@
12 years ago
Replying to DrewAPicture:
'public' => trueor
'public' => array( 'admin_menu' => false, 'meta_box' => true )
I wouldn't add an array. We already got public => true
for both of them. Why add admin_menu => false
when the whole thing is an A/B decision: meta_box/admin_menu
: yes = set in string. No need for an array, as we don't need to state false
for the second option - the typeOf( string )
already tells us, that we only want one of them.
#6
@
12 years ago
Setting 'meta_box => true
isn't actually necessary, I just added it for the comparison.
'public' => array( 'admin_menu' => false )
Is exactly the same.
The reason I went with an array instead of a string was so that we wouldn't get stuck with an A/B decision. It future-proofs the public
param. Look at it from an extensibility standpoint. In the future a need to add another argument would be trivial, but turning an A/B
decision into an A/B/C
decision would probably result in an array anyway.
#8
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
I believe this should actually work now through the addition of the meta_box_cb
arg - you should be able to pass false and have no meta box be used. Closing as a dupe of #14206.
#9
follow-up:
↓ 10
@
11 years ago
- Milestone set to Awaiting Review
- Resolution duplicate deleted
- Status changed from closed to reopened
Oh, I lied. It gets mad if you pass false. Reopening - I think we should make that work.
#10
in reply to:
↑ 9
@
11 years ago
Replying to helen:
Oh, I lied. It gets mad if you pass false. Reopening - I think we should make that work.
+1 for making that work. Seems logical :)
#12
@
11 years ago
- Owner set to helen
- Resolution set to fixed
- Status changed from reopened to closed
In 25948:
#13
@
11 years ago
- Keywords 2nd-opinion removed
- Resolution fixed deleted
- Status changed from closed to reopened
IMO we should put the check a bit higher, see 21543.5.diff.
#15
follow-up:
↓ 16
@
11 years ago
- Keywords 2nd-opinion added
- Type changed from enhancement to feature request
#21543
This only solves half of the ticket. Although the meta-box can be turned off now, the admin-menu still can't.
#16
in reply to:
↑ 15
@
11 years ago
- Keywords 2nd-opinion removed
- Type changed from feature request to enhancement
Replying to webvakman:
This only solves half of the ticket. Although the meta-box can be turned off now, the admin-menu still can't.
You can set show_ui
parameter to false, which will disable both the meta box and the admin menu item.
This ticket was closed on a completed milestone. If you have additional suggestions, please open a new one.
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:
We could simply extend the test and check for a string value too:
This would be backwards compatible and allow showing in the menu or the meta box without major changes.