I have a CPT of Projects that uses the post_tag feature. My CPT tags are also showing up in my regular blog post area under Tags. I added a new "regular" post tag and it also showed up in the CPT Projects tag list. How do I keep these separate? I have CPT specific tag cloud being used on a page, so it can't show tags from regular posts. Thanks. Code is below:

function projects_register() {

register_post_type('projects', array(   
    'description' => 'Projects',
    'show_ui' => true,
    'menu_position' => 5,
    'exclude_from_search' => false,
    'labels' => array(
        'name' => 'Projects',
        'singular_name' => 'Projects',
        'add_new' => 'Add Project',
        'add_new_item' => 'Add New Project',
        'edit' => 'Edit Project',
        'edit_item' => 'Edit Project',
        'new_item' => 'New Project',
        'view' => 'View Project',
        'view_item' => 'View Project',
        'search_items' => 'Search Projects',
        'not_found' => 'No Project found',
        'not_found_in_trash' => 'No Project found in Trash',

    'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
    'public' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => true,
    'rewrite' => array('slug' => 'projects', 'with_front' => true),
    'taxonomies' => array('category', 'post_tag'),
    'has_archive' => true

register_taxonomy( 'project', 'projects', array( 'hierarchical' => true, 'label' => 'Projects Categories', 'query_var' => true, 'rewrite' => true ) );  


add_action('init', 'projects_register');
  • Checkout 'exclude_from_search'. Right now you have it set to 'false', which means this post type is included in search results. I think there's a similar attribute for tags – AJ Zane Jan 30 '14 at 22:44
  • I need the "Projects" to come up in search results...so I would keep that set as false i assume? – JeanLeSheep Jan 30 '14 at 23:15
  • It looks like the Project CPT is using the 'category' and 'post_tag' taxonomies, so cats and tags are shared with any other post type using those (which is the default Posts). Checkout this codex page: codex.wordpress.org/Function_Reference/register_post_type and scroll down to 'taxonomies' (or search for 'post_tag'). I think you'll need to register a new taxonomy (project_tags) and add that tax to your Project CPT And yes, if you need Projects to come up in search results, leave it false – AJ Zane Jan 31 '14 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.