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'm creating a custom post type by adding the add_action( 'init', 'create_radiotalks' ); text to the functions.php page:

add_action( 'init', 'create_radiotalks' );

function create_radiotalks() {
    register_post_type( 'radiotalks',
        array(
            'labels' => array(
            'name' => __( 'Radio Talks' ),
            'singular_name' => __( 'Radio Talk' ),
            'add_new' => __( 'Add New' ),
            'add_new_item' => __( 'Add New Radio Talk' ),
            'edit' => __( 'Edit' ),
            'edit_item' => __( 'Edit Radio Talk' ),
            'new_item' => __( 'New Radio Talk' ),
            'view' => __( 'View Radio Talk' ),
            'view_item' => __( 'View Radio Talk' ),
            'search_items' => __( 'Search Radio Talks' ),
            'not_found' => __( 'No radio talks found' ),
            'not_found_in_trash' => __( 'No radio talks found in Trash' ),
            'parent' => __( 'Parent Radio Talk' ),
),
            'public' => true,
        )
    );
}

when entering the add new radio talk info, I would like to add the applicable categories and tags, but they do not show up in the admin side bar? How do I make the categories/tags available to my custom post type? thanks for your help.

-don

share|improve this question
add comment

2 Answers

By adding the 'taxonomies' argument:

'public' => true,
'taxonomies' => array( 'category', 'post_tag' ),
share|improve this answer
    
thanks for your help, scribu. –  don de lion Mar 10 '11 at 6:44
add comment

or by register taxonomy:

<?php
register_taxonomy_for_object_type('category', 'radiotalks');
register_taxonomy_for_object_type('post_tag', 'radiotalks');
share|improve this answer
    
thanks for your response, Marcin. This site's really helping me flesh out what's possible w/wordpress. –  don de lion Mar 10 '11 at 6:45
    
Is there any benefit to Marchin's approach vs. scribu's above? or is it just semantics? –  don de lion Mar 10 '11 at 7:05
    
The 'taxonomies' method is just a shortcut for register_taxonomy_for_object_type(). –  scribu Mar 10 '11 at 7:21
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.