Ensure taxonomy exists in wc_get_product_visibility_term_ids

This commit is contained in:
Mike Jolley 2017-06-06 13:10:56 +01:00
parent e83450b861
commit 253bb0743c
1 changed files with 4 additions and 0 deletions

View File

@ -781,6 +781,10 @@ add_action( 'set_object_terms', 'wc_clear_term_product_ids', 10, 6 );
* @return int[]
*/
function wc_get_product_visibility_term_ids() {
if ( ! taxonomy_exists( 'product_visibility' ) ) {
wc_doing_it_wrong( __FUNCTION__, 'wc_get_product_visibility_term_ids should not be called before taxonomies are registered (woocommerce_after_register_post_type action).', '3.1' );
return array();
}
return array_map( 'absint', wp_parse_args(
wp_list_pluck(
get_terms( array(