-
Hi Everyone,
Grateful if you could please help, i would like to call the primary category through Rankmath.Previously I was with yoast i was the using the below code
$primary_cat_id=get_post_meta($product->id,'_yoast_wpseo_primary_product_cat',true); if($primary_cat_id){ $product_cat = get_term($primary_cat_id, 'product_cat'); echo $product_cat->name; }
The code still work for old product but for new one it is not working.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The ticket ‘Get primary category’ is closed to new replies.