Opened 9 years ago
Last modified 6 years ago
#35250 new enhancement
Enable developer to omit "internal" taxonomies from return value of get_taxonomies()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch needs-docs |
Focuses: | Cc: |
Description
I frequently use one or two taxonomies in a project that users should never see, but plugins that use the get_taxonomies()
function are able to display my internal taxonomies to users. get_taxonomies()
does not filter for show_in_nav_menu
or show_in_nav_menu
_(and probably should not.)_ so I can't correct this proactively. Thus I would like to be able to filter out my internal taxonomies so they will be invisible to plugins and themes.
I am uploading a patch that adds a 'get_taxonomies'
filter for this.
Another option would be to introduce a 'internal'
property at taxonomy registration and then filter for that being false
in get_taxonomies()
and probably elsewhere, or introduce the idea of underscore prefixed taxonomies being hidden.
Any of those would work for me. Thanks in advance for considering.
Attachments (1)
Change History (7)
#3
@
9 years ago
That sounds helpful to me as well, I don't see a filter in wp_filter_object_list
either, so this one may come handy.
#4
follow-up:
↓ 5
@
9 years ago
I'm not sure we should make it easy for developers to "hide" their taxonomy, even if only used internally to their plugin or theme.
Rather, anyone who is listing taxonomies, should probably only list what makes sense in their context - for example, only showing taxonomies with public => true
.
#5
in reply to:
↑ 4
@
9 years ago
Replying to dd32:
Rather, anyone who is listing taxonomies, should probably only list what makes sense in their context - for example, only showing taxonomies with
public => true
.
Sadly, that does not follow ''Postel's Law'':
Be conservative in what you do, be liberal in what you accept from others
Depending on others to do what they "should" be doing, especially in the WordPress plugin and theme ecosystem, is just asking for trouble. Much better for a developer to take steps to ensure someone else can't create a problem rather than hope that they do not.
Adds 'get_taxonomies' filter