Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type called project with custom taxonomy called tagportfolio
I use this code to generate both:

 add_action('init', 'project_custom_init');    

/*-- Custom Post Init Begin --*/  
function project_custom_init()  
{  
  $labels = array(  
  'name' => _x('Projects', 'post type general name'),  
  'singular_name' => _x('Project', 'post type singular name'),  
  'add_new' => _x('Add New', 'project'),  
  'add_new_item' => __('Add New Project'),  
  'edit_item' => __('Edit Project'),  
  'new_item' => __('New Project'),  
  'view_item' => __('View Project'),  
  'search_items' => __('Search Projects'),  
  'not_found' =>  __('No projects found'),  
  'not_found_in_trash' => __('No projects found in Trash'),  
  'parent_item_colon' => '',  
  'menu_name' => 'Project'  
);  

$args = array(  
  'labels' => $labels,  
  'public' => true,  
  'publicly_queryable' => true,  
  'show_ui' => true,  
  'show_in_menu' => true,  
  'query_var' => true,  
  'rewrite' => true,  
  'capability_type' => 'post',  
  'has_archive' => true,  
  'hierarchical' => false,  
  'menu_position' => null,  
  'supports' => array('title','editor','author','thumbnail','excerpt','comments')  
);  

// The following is the main step where we register the post.  
register_post_type('project',$args);  

// Initialize New Taxonomy Labels  
$labels = array(  
  'name' => _x( 'Tags', 'taxonomy general name' ),  
  'singular_name' => _x( 'Tag', 'taxonomy singular name' ),  
  'search_items' =>  __( 'Search Types' ),  
  'all_items' => __( 'All Tags' ),  
  'parent_item' => __( 'Parent Tag' ),  
  'parent_item_colon' => __( 'Parent Tag:' ),  
  'edit_item' => __( 'Edit Tags' ),  
  'update_item' => __( 'Update Tag' ),  
  'add_new_item' => __( 'Add New Tag' ),  
  'new_item_name' => __( 'New Tag Name' ),  
);  

// Custom taxonomy for Project Tags  
register_taxonomy('tagportfolio',array('project'), array(  
  'hierarchical' => true,  
  'labels' => $labels,  
  'show_ui' => true,  
  'query_var' => true,  
  'rewrite' => array( 'slug' => 'tag-portfolio' ),  
));  

}  
/*-- Custom Post Init Ends --*/      

But when I use the get_terms() function it didn't shows any taxonomies

Then is used the function below:

get_terms("tagportfolio",array('hide_empty'=>0));

It also didn't show any of my taxonomies

share|improve this question
1  
At the risk of asking an obvious question, have you created any terms in your custom taxonomy? (Also, on a sidenote, I would name it something unique, like "Portfolio Tag" to reduce confusion between your taxonomy and the core "Tags" taxonomy.) –  mrwweb Mar 12 '13 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.