Are you looking for a way to enable tag selection within the editor for that custom post type? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add tag selection to custom post type in WordPress.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
function reg_tag() { register_taxonomy_for_object_type('post_tag', 'CUSTOM_POST_TYPE'); } add_action('init', 'reg_tag');
Don’t forget to change the CUSTOM_POST_TYPE
to the name of the custom post type you created.
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 23 best WordPress themes for non-profits and how to save partial form data in WordPress.
Sorry I’m dumb, but this code adds tags to desired CPT, okay, but it adds already created tags I made for default Posts. How to adjust code so my CPT will have its own unique tags? Thank you!
Nice snippet. It saved me, thanks a lot !