The actual post type support categories and I want to add also support for tags.

I have this code:

    'category_' . $slug,
    array( $slug ), 
        'hierarchical' => true,
        'label' => "$slug Categories",
        'singular_label' => "$slug Category",
        'rewrite' => true

So, I was trying to duplicate this for supporting tags but is not working.

This is the entire code for portfolio post type :

$portfolio_slugs = get_option("zeitgeist_portfolio_slug");
    foreach ( $portfolio_slugs as $slug ){
        add_action('init', 'create_portfolio');
        register_taxonomy("category_".$slug, array($slug), 
        array("hierarchical" => true, "label" => "$slug Categories", "singular_label" => "$slug Category", "rewrite" => true));
        register_taxonomy("tags_".$slug, array($slug), array("hierarchical" => false, "label" => "$slug Tags", "singular_label" => "$slug Tags", "rewrite" => true));

function create_portfolio() {
    $portfolio_slugs = get_option("zeitgeist_portfolio_slug");
    $portfolio_counter = 0;
    $portfolio_names = get_option("zeitgeist_portfolio_name");
    foreach ( $portfolio_slugs as $slug ){
        $portfolio_args = array(
            'label' => __("Portfolio '".$portfolio_names[$portfolio_counter]."'"),
            'singular_label' => __($portfolio_names[$portfolio_counter++]),
            'public' => true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'rewrite' => array('slug' => $slug, 'with_front' => true),
            'supports' => array('title', 'editor', 'thumbnail', 'author', 'comments', 'excerpt')

function portfolioSingleRedirect(){
    global $wp_query;
    $queryptype = $wp_query->query_vars["post_type"];
    $portfolio_slugs = get_option("zeitgeist_portfolio_slug");
        foreach ( $portfolio_slugs as $slug ){
            if ($queryptype == $slug){
                if (have_posts()){
                    global $pcat;
                    $pcat = "category_".$slug;
                    require(TEMPLATEPATH . '/single_portfolio.php');
                    $wp_query->is_404 = true;
add_action("template_redirect", 'portfolioSingleRedirect');

2 Answers 2


The categories your code creates is a custom taxonomy, not the default post category taxonomy.

Anyway, if you want to add support for the default post tags taxonomy, the name is post_tag and can be added via the taxonomies argument in your $portfolio_args:

$portfolio_args = array(
    'taxonomies' => array( 'post_tag' ),
    // all of your other portfolio args

See register_post_type in Codex for more info.

  • Actually I need a custom taxonomy tag exactly like the categories taxonomy in my code
    – agis
    Jan 18, 2013 at 22:06
  • in register_taxonomy arguments change 'hierarchical' => true to 'hierarchical' => false to make them behave like the default tags taxonomy.
    – Milo
    Jan 18, 2013 at 22:09
  • I've tried to register a new taxonomy like categories but with hierarchical - false but is still not working. Or if you can make an edit of my code maybe I miss something.
    – agis
    Jan 18, 2013 at 22:32
  • what's not working exactly? you've created a taxonomy and it's not hierarchical? if your problems are simply php errors, I suggest enabling debugging and working through them line by line.
    – Milo
    Jan 18, 2013 at 23:02
  • I've duplicated the register_taxonomy it was used for creating the categories but with hierarchical - false and I recieve : Parse error: syntax error, unexpected $end on line 52 which is the last line in my code
    – agis
    Jan 19, 2013 at 16:17

You have to add 'taxonomies' => array( 'post_tag' ) like others have said, but you also have to add 'taxonomies' in the 'supports' argument for the taxonomy boxes to show up in the admin page, like so

'supports' => array('title','editor','thumbnail','taxonomies')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.