Display custom tags for custom post listing page

I’m very new to WordPress, but I’ve created a custom post type with two sets of tags. I’ve added the tags by using the following code:

/**
* custom tags
*/
function gccsi_create_client_tax() {

/* Teams */
register_taxonomy(
‘post_team’, ## tag name
array( ‘team’, ‘board’ ), ## post type
array(
‘hierarchical’ => false,
‘label’ => __( ‘Teams’, CURRENT_THEME ),
‘singular_name’ => __( ‘Team’, CURRENT_THEME ),
‘rewrite’ => true,
‘query_var’ => true
)
);

/* Locations */
register_taxonomy(
‘post_location’, ## tag name
array( ‘team’, ‘board’ ), ## post type
array(
‘hierarchical’ => false,
‘label’ => __( ‘Locations’, CURRENT_THEME ),
‘singular_name’ => __( ‘Location’, CURRENT_THEME ),
‘rewrite’ => true,
‘query_var’ => true
)
);

}
add_action( ‘admin_init’, ‘gccsi_create_client_tax’ );

Which seems to work fine, I’m trying to now display those tags on the main page (which displays all items) so people can filter the listing page. I’ve tried the following:

$tagsTeam = get_terms( ‘post_team’ ); ## I also tried get_terms( ‘team’ );
echo ‘<pre>’;print_r($tags);echo ‘</pre>’;

Which gives me this:

WP_Error Object
(
[errors] => Array
(
[invalid_taxonomy] => Array
(
[0] => Invalid taxonomy.
)

)

[error_data] => Array
(
)

)

I’ve also tried using:

the_tags();

But that doesn’t display anything. I’ve searched but I can’t seem to find anything else that doesn’t need the ID?

Any help would be appreciated!

Read more here:: Display custom tags for custom post listing page

Leave a Reply

Your email address will not be published. Required fields are marked *