Im having this code

$concours_termine_cat = get_term_by('slug' , 'concours-termine' , 'product_cat');

get_term_by is returning false, after debugging the get_term_by function

taxonomy_exists( 'product_cat'); 

is returning false.

So I checked in taxonomy_exists function and looks like into $wp_taxonomies product_cat doesn't exist at this time of execution.

I call this hook like this add_action('transition_post_status' , 'vince_function_post_update' , 10 , 3);

1 Answer 1


I don't know why Woocommerce wasn't load at this time but I solve my issue adding this code :

if (! taxonomy_exists(  'product_cat' ) && class_exists('WC_Post_Types') ) {
    // Dans le cas ou la taxonomies n'est pas register

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.