-
Hi there!
We have a website that is pulling its data from a third party api service so we have created an importer and all works okay, the only issue we have is setting the primary category during the import as there is quite a few products 500+ and each will need a primary category setting for the breadcrumbs to be consistent across the site.
Your chatbot suggested using the following:
update_post_meta($post_id, 'rank_math_primary_category', (int)$parent_category_term->term_id);However we have had no success.
The full code is here:
// Set Parent Category Taxonomy
if ( ! empty($product['Catagory']['Level1'])) {
$parent_category_term = Helpers::setPostTerm(
$product['Catagory']['Level1'],
'product-categories',
(int)$post_id
);// Update Rank Math Primary Category
update_post_meta($post_id, 'rank_math_primary_category', (int)$parent_category_term->term_id);
}
The actual creation and assignment of the category taxonomy works fine, it is only the marking of the primary category to rank math that is the issue.
Any help would be greatly appreciated.
Thanks,
Jordan
You must be logged in to reply to this ticket.