I have several sites with custom post types and taxonomies registered by different plugins. Is there a way to add or change a parameter like this:
'rewrite' => array( 'hierarchical' => true )
by adding something to functions.phpâwithout completely re-registering the type/taxonomy? I want to continue to use certain plugins to manage types and taxonomies, but not all parameters are provided.
you could modify the global variable $wp_post_types or in the case of taxonomies, $wp_taxonomies
for example, this will change the menu name and all the labels for the default Posts to Bacon:
source:
http://new2wp.com/snippet/change-wordpress-posts-post-type-news/
WordPress has multiple functions that allow for the type of thing you’re trying to do.
Check out:
If you want to remove a taxonomy, you have to reregister itâusing register_taxonomy()âand then omit the post type(s) you don’t want from the $object_type argument’s array. Then, make sure you’re hooking to function to a hook that runs after it’s first registered (or on the same hook but at a lower priority).
p.s. Sorry I couldn’t link to all these (not enough reputation points). All those functions have entries in the codex; just google them.
Since WordPress 4.4 there is a hook that you can use for that use-case, it is called register_taxonomy_args.
It lets you modify the arguments of a taxonomy before it is actually registered and it works even for the internal taxonomies.
Here is an example which sets the ‘category’ taxonomy urls to hierarchical: