Viewing Unique Custom Post Types Categories

Asked

Viewed 984 times

4

I created a Custom Post Type, but now I’m not able to create categories that are seen only for this CPT.

When adding 'taxonomies' => array('category'), it displays all categories. How can I resolve this?

2 answers

1

I used the following code before the register_post_type and it worked! This one for those who have the same doubt.


 register_taxonomy( 'images', 
    array('images'), /* This is the name of your custom post type, I used "Images" */
    array('hierarchical' => true,     /* if this is true it acts like categories */             
        'labels' => array(
             /* OPTIONS */
        ),
        'show_ui' => true,
        'query_var' => true,
    )
);    

register_post_type( 'images',
    array(
        'labels' => array(
            'name' => __( 'Images' ),
            'singular_name' => __( 'images' ),
            'add_new' => __('New', 'Image'),
        ),
        'public' => true,
        'capability_type' => 'post',
        'rewrite' => array('slug' => 'images/test','with_front' => FALSE)
    )
);
  • I have a similar problem, but my custom post type has not worked the taxonomy that would be the categories http://answall.com/questions/15052/wp-custom-post-type/15175?noredirect=1#15175 http://pastebin.com/kKgPTyQJ

1

For those who didn’t understand the solution:

The problem was in using a taxonomy reserved by Wordpress in the case Category, when using images worked normally.

  • 2

    You should comment (or edit) on his reply instead of creating a new one. ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.