get_terms not returning any custom taxonomies

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

Read More

Then is used the function below:

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

It also didn’t show any of my taxonomies

Related posts

Leave a Reply

1 comment