Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I cannot get TAGS to work within my custom post types.

I have the following to establish my custom post type:

function Work() {
    $labels = array(
        'name'               => _x( 'Work', 'post type general name' ),
        'singular_name'      => _x( 'Work', 'post type singular name' ),
        'add_new'            => _x( 'Add New', 'Work' ),
        'edit_item'          => __( 'Edit Work' ),
        'new_item'           => __( 'New Work' ),
        'all_items'          => __( 'All Work' ),
        'view_item'          => __( 'View Work' ),
        'search_items'       => __( 'Search Work' ),
        'not_found'          => __( 'No Work Found' ),
        'not_found_in_trash' => __( 'No Work Found In The Trash' ), 
        'parent_item_colon'  => '',
        'menu_name'          => 'Work'
    );
    $args = array(
        'labels'        => $labels,
        'description'   => 'Holds our Work and Work specific data',
        'public'        => true,
        'menu_position' => 5,
        'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
        'has_archive'   => true,
        'taxonomies' => array('category')

    );
    register_post_type( 'Work', $args );

If I take: 'taxonomies' => array('category') and edit to array('tags') nothing happens. Shouldn't that make tags work with my custom post type?

I also found this code:

function reg_tag() {
         register_taxonomy_for_object_type('post_tag', 'CUSTOM_POST_TYPE');
}
add_action('init', 'reg_tag');

and added it to my functions file as well, but no luck with that either.

Can anyone point me in the right direction?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You need to use 'taxonomies' => array( 'post_tag' ) to add tags support for a custom post type, like this:

function Work() {
    $labels = array(
        'name'               => _x( 'Work', 'post type general name' ),
        'singular_name'      => _x( 'Work', 'post type singular name' ),
        'add_new'            => _x( 'Add New', 'Work' ),
        'edit_item'          => __( 'Edit Work' ),
        'new_item'           => __( 'New Work' ),
        'all_items'          => __( 'All Work' ),
        'view_item'          => __( 'View Work' ),
        'search_items'       => __( 'Search Work' ),
        'not_found'          => __( 'No Work Found' ),
        'not_found_in_trash' => __( 'No Work Found In The Trash' ), 
        'parent_item_colon'  => '',
        'menu_name'          => 'Work'
    );
    $args = array(
        'labels'        => $labels,
        'description'   => 'Holds our Work and Work specific data',
        'public'        => true,
        'menu_position' => 5,
        'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
        'has_archive'   => true,
        'taxonomies' => array('category', 'post_tag'),

    );
    register_post_type( 'Work', $args );
}
share|improve this answer
    
Ah! Haha, so simple. Thank you Eugene! –  Anthony Myers Sep 15 '13 at 21:07
    
u r welcome! if the answer resolves your issue, then mark it as correct and vote up it :D –  Eugene Manuilov Sep 15 '13 at 21:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.