Display CustomPress taxonomy

Using taxonomy embed code inside theme template to display post terms for custom post type.
echo do_shortcode('[tax id="boo" before="your text before " separator=", " after=" your text after"]');

But nothing is being rendered .

Tried to output the terms using WordPress built-in functions:
var_dump( get_the_terms(the_ID(), 'roles') );

I get the following error:
238object(WP_Error)#1993 (2) {
array(1) {
array(1) {
string(17) "Invalid taxonomy."
array(0) {

And that returns the post ID and bool(false):
var_dump( get_the_term_list(the_ID(), 'role') );

  • Adam Czajczyk

    Hello Lacey

    I hope you're having a nice day!

    I have exported Custom Post Type settings and Custom Taxonomy settings from your site to be able to test them on my end. I've checked both codes - the shortcode and the "var_dump()" snippet - and they are fine.

    The "var_damp()" gives you the "Invalid Taxonomy" error because the taxonomy name is actually "role" and not "roles". A shortcode code that you shared uses just "boo" where it should use taxonomy name so I suppose that you have also tried "roles" there.

    With "role" taxonomy instead both codes should be working fine:

    echo do_shortcode('[tax id="role" before="your text before " separator=", " after=" your text after"]');

    var_dump( get_the_terms(the_ID(), 'roles') );

    As for this code:

    var_dump( get_the_term_list(the_ID(), 'role') );

    It will only return any results if there actually are terms associated with a given post; if the post does not have any terms associated it will return "false". Also, there's no need to use "var_damp()" here because "get_the_term_list()" returns a HTML formatted string.

    Kind regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.