If you want to get product tags in array in WooCommerce? You need to loop through the array and create a separate array to check in_array() because get_terms() return object with in array.
1 2 3 4 5 6 7 | $terms = get_terms( 'product_tag' ); $term_array = array(); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { $term_array[] = $term->name; } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.