× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Asociate Wordpress Taxonomy to multiple post types

Nicolas Fernandez
Dec 15, 2015
<p>You can associate one taxonomy to multiple posts types like post, page, custom post types, attachment, revision, nav_menu_item...</p> <p>The way to do it is to pass in either a string or an array containing the post types to the second argument of register_taxonomy like so</p> <pre><code class="language-php">&lt;?php $post_types = array("post", "page", "my_custom_post_type", "attachment"); register_taxonomy( "myTaxonomy", $post_types, $args ); ?&gt; </code></pre> <p> </p> <p>Just make sure that all the post types names are in lower-case and without any spaces.</p>
comments powered by Disqus