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

I'd like to add a custom post type "News" that has it's own Tags and Categories and I'd like to add the appropriate code to my functions.php file.

I've tried plugins but I don't get tags and categories columns in the list of posts in the new post type.


share|improve this question
up vote 2 down vote accepted

Creating the Post Type

register_post_type is your friend here. This is what plugins etc use to register the post type.

For example here is a basic Books post type:

function codex_custom_init() {
    $args = array(
      'public' => true,
      'label'  => 'Books'
    register_post_type( 'book', $args );
add_action( 'init', 'codex_custom_init' );

If you don't want to write the code, there's a site that will give you a form, answer some questions, and it will give you code at the end to copy paste, here are two such sites:

Creating the Tags and Categories

Custom taxonomies are similar, and you'll want 2 of them for tags and categories.

register_taxonomy is the function that registers a custom taxonomy. Here's a genre taxonomy for the book example given above:

add_action( 'init', 'create_book_tax' );

function create_book_tax() {
            'label' => __( 'Genre' ),
            'rewrite' => array( 'slug' => 'genre' ),
            'hierarchical' => true,

Your 2 taxonomies will be the same except:

  • tags will be hierarchical, categories will not
  • they'll have different names and labels

You'll need to name them separately so they don't conflict with the existing post type and taxonomies, so News Category, not Category, and News Tags, not Tags.

The sites with the easy to fill out forms also have generators for taxonomies too.

Columns in Post Listings

v3.5 added this attribute to register_taxonomy:


If set to true it will add a column as you desire showing the terms of each post

Where should the code reside

Probably in a plugin, not in the theme. If they were in the theme, and the user switched themes, they'd loose all their data.


Custom post types don't have date archives, and adding date archives is a nontrivial, and difficult thing to do, something that is far and above beyond what your current skills are if you're asking the question you asked. Needing date archives in a custom post type usually means you're doing something you should have used normal posts for and have made a mistake somewhere in your design.

There will also be a post type/taxonomy prefix, you can't give them the exact same URL structure as posts. If you did, they would clash, and either your News post type, or your standard posts would 404. ( If you did I would recommend you just use posts and you're doing something wrong to even have a separate news post type ).

When you've written your code, flush your permalinks to test else the archives will give 404s.

What I Suspect You Actually Want

I suspect your next question will be how to hide Posts in the admin menu and the frontend menu. To which I present these alternative solutions:

  • Rename Posts to News without creating a whole new post type
  • Use a custom taxonomy or a category to separate news from other things.
share|improve this answer

When you define the Custom Post Type you decide if all those attributes are available or not, so I guess you're not doing it correctly.

Have a read of the documentation here: http://codex.wordpress.org/Function_Reference/register_post_type

I find by far the easiest way to generate Custom Post Types is this CPT Generator:


share|improve this answer

Match the Core registration for the "Post" post type:

20          register_post_type( 'post', array(
21                  'labels' => array(
22                          'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
23                  ),
24                  'public'  => true,
25                  '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
26                  '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type.
27                  'capability_type' => 'post',
28                  'map_meta_cap' => true,
29                  'hierarchical' => false,
30                  'rewrite' => false,
31                  'query_var' => false,
32                  'delete_with_user' => true,
33                  'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields',
'comments', 'revisions', 'post-formats' ),
34          ) );

You will obviously need to register a different post type name and note the two lines marked "Internal use only". Remove those. Otherwise, that should give you a clone of the Core "Post" 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.