Can I use a Custom Meta Value inside of ‘get_the_terms’?

I have a custom Page Template, and this is the code that I am trying to manipulate to change depending on a custom meta value that I write for specific Pages.

$terms = get_the_terms($post->id, 'custom-taxonomy' );

On the Page CPT, I have a custom meta field “Taxonomy Name”, and the custom meta value is “Custom Taxonomy”

Read More

What I am trying to do with the code above is:

$terms = get_the_terms($post->id, get_post_meta($post->ID,'metafield-taxonomy-name',TRUE) );

Obviously (through actually trying it ;)), that snippet doesn’t work since the meta value is not passing through in quotes.

Is there a way I can achieve this, so that ‘get_the_terms’ can be changed dynamically depending on the meta value that I give it?

Thanks!

Roc.

Related posts

1 comment

Comments are closed.