I’m using some custom posts types, and, I don’t wanna create specific categories for each one.

I’d like to use the Post Category in all my Custom Post.

Here is a example of my new custom posts type:

I know how create new category type for my custom posts, but I don’t know how use the regular categories from posts.

/*  New Custom Post - Cupons
/* ------------------------------------ */

add_action( 'init', 'create_post_type_cupons' );
function create_post_type_cupons() {
    register_post_type( 'cupom',
        array(
            'labels' => array(
                'name' => __( 'Cupons' ),
                'singular_name' => __( 'Cupom' )
            ),
            'public' => true,
        )
    );
}

3 Answers
3

The documentation for register_post_type mentions a taxonomies parameter, giving it a value of array( 'category' ) will do what you want.

There is also the register_taxonomy_for_object_type function

Leave a Reply

Your email address will not be published. Required fields are marked *