Adding wordpress taxonomy name on a list table in the post with shortcode

Hi there

I have constructed a function that return taxonomy post term array by using (wp_get_post_terms function) in wordpress. I added this function to the functions.php file of my custom theme and then define shortcode with add_shortcode() function for showing parameter name of taxonomy. My problem is that this shortcode not working with array function. (it’s worked perfectly on outside of the function but on function ????)

Any help, please?
My code:

function post_industry($atts){
$term_list = wp_get_post_terms($post->ID, ‘city’, array(“fields” =>
“all”));
return $term_list[0]->name ;
}
add_shortcode( ‘post_industry’, ‘post_industry’ );

Read more here:: Adding wordpress taxonomy name on a list table in the post with shortcode

Leave a Reply

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