get_the_terms, whether I should use string or array as the second parameter?
When I running Query Monitor on one of my page, I get a notice “Array to string conversion” for the following line:
$terms = get_the_terms( $post->ID , array( 'product-categories') );
I then check the document for get_the_terms at https://developer.wordpress.org/reference/functions/get_the_terms/, the second parameter is a string.
However, after reading further, I find some samples in the above link and some are using string directly, like below:
$terms = get_the_terms( $post->ID , array( 'teams_positions') );
but some uses an array, like below:
$post_categories = get_the_terms( $post->ID, 'category' );
So I am totally confused.