WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For the life of me I cannot seem to get categories to come into existence with my custom post type. I've added the following — simple — code to the bottom of my theme's functions.php file, yet see no categories in my custom post from the admin side.

register_post_type("customy", array(
    'label' => 'Customy',
    'description' => 'Custom stuff for this site.',
    'public' => true,
    'hierarchical' => true,
    'supports' => array('title', 'editor', 'author', 'thumbnail', 'revisions'),
    'taxonomies' => array('category')
register_taxonomy_for_object_type('category', 'customy');
share|improve this question
up vote 5 down vote accepted

It appears that although register_post_type() will add the new post_type immediately, it seems as though you need to bind up the logic into a function, and add it to the init action for the categories taxonomy to be associated with the post_type. A working example follows:

function add_articles_post_type() {
  register_post_type("article", array(
    'label' => 'Article',
    'public' => true,
    'hierarchical' => true,
    'supports' => array('title','editor','author','thumbnail','revisions')
  register_taxonomy_for_object_type('category', 'article');
add_action('init', 'add_articles_post_type');
share|improve this answer

Your Answer


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.