Use register_taxonomy() in register_activation_hook()

Is the data not stored in the database but rather in memory? Taxonomies (like post types) aren’t store in database and needs to be registered on every page load. The build in taxonomies, category and post_tag are actually registered twice, the second time on the init hook. The init hook is the earliest to register … Read more

update_count_callback argument in register_taxonomy function not working

When you query attachments, you have to take care about the post_status argument that have a different meaning than for other post types. Attachments have the status of inherit which means that there status should be the same as their parent post (ie the post from where they have been uploaded). This makes attachments associated … Read more

Custom taxonomies, with custom rewrites/slug, AND loading a taxonomy archive template from a plugin

Background & Core Functionality Why a Taxonomy Path Slug Alone Produces a 404 However this slug doesnt work. mysite.com/wiki/help-topics throws a 404. WordPress does not provide a mechanism for “an archive of taxonomy terms” out of the box – that is, neither the template hierarchy nor the WP_Query/WP_Tax_Query logic support a direct display of terms … Read more

How can I fix those issues generated by the Themecheck plugin

Registering custom posts is a plugin territory. It means that you need to remove them from the theme’s functionality and register them via a plugin (usually recommended when installing the theme using TGM Plugin Activation or something else). Here are the recommendations of the Theme Review Team. Themes must not incorporate the following, Plugin-territory functionality. … Read more

How to modify a taxonomy that’s already registered

register_taxonomy() is the tool for the job. From the Codex: This function adds or overwrites a taxonomy. One option would be to copy the register_taxonomy() $args and modify them. However, that would mean that any future changes to the original register_taxonomy() code would be overwritten. Therefore, at least in this case, it’s preferable to get … Read more

Can multiple custom post types share a custom taxonomy?

Sharing a taxonomy between CPTs I would like to know if two custom content types can share one custom taxonomy. Simple said: Yes, they can. How to share You should always register custom taxonomies and post types to each other as early as possible. Wrap your registration process in a function, hooked to the init … Read more