• Resolved nicole0155

    (@nicole0155)


    Hi,

    I need to set several primary categories for a large number of products. For such purpose I have used a code with

    update_post_meta( $product_id, '_yoast_wpseo_primary_product_cat', $primary_category_id );

    inside a block hook like woocommerce_update_product and save_post.

    However, such code is not updating the primay category for any product. I have also used a direct database update, but also did not worked.

    Is there any limitation and/or an alternative method to deal with this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @nicole0155,

    Thanks for using the Yoast SEO plugin. We don’t have a feature in the plugin or hook to share that allows you set the primary product category in bulk.

    Thread Starter nicole0155

    (@nicole0155)

    Hi @maybellyne

    We have solved the issue using the follwoing hook

    wp_insert_post

    For some reason the previous hooks does not work to update_post_meta for the particular case of _yoast_wpseo_primary_product_cat.

    So, we are now changing programmatically the Yost primary category with a developed script.

    Thanks.

    Plugin Support Maybellyne

    (@maybellyne)

    Thanks for sharing.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.