add rank math data by php

#52760
  • Resolved Andreas Tanke
    Rank Math business

    Hi, I try to add the Rank Math SEO data by php, ’cause I have 1000 products and most of them are using similar values. So I’ve tried that:
    update_post_meta($productID_de, “rank_math_description”, wp_kses_post($categorydescription_de));
    update_post_meta($productID_de, “rank_math_focus_keyword”, $focus_keyword_de);
    update_post_meta($productID_de, “rank_math_primary_product_cat”, $categoryID_de);

    update_post_meta($productID_en, “rank_math_description”, wp_kses_post($categorydescription_en));
    update_post_meta($productID_en, “rank_math_focus_keyword”, $focus_keyword_en);
    update_post_meta($productID_en, “rank_math_primary_product_cat”, $categoryID_en);
    But it doesn’t work fine.

    The english products are broken and the seo score wasn’t calculated.
    Can you help me to achieve this?

    Best Regards

    Andreas

Viewing 3 replies - 1 through 3 (of 3 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    What do you mean with your products are broken? Could you give us more details? About the SEO Score, it is calculated using some JS, so to display it needs to be opened the post.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    I have to check in the meantime some other issues, but it the way
    with the three postmeta updates per product the right way?
    Or are these informations stored in any other place, too?

    Isn’t there a chance to force the JS in any other way? It it impossible to open all products and translations manually. I really need an automatic or at least bulk option for it.

    Best Regards

    Andreas

    Hello,

    Isn’t there a chance to force the JS in any other way?

    Sorry, there is no other way to update the score without opening the post.

    I have to check in the meantime some other issues, but it the way
    with the three postmeta updates per product the right way?
    Or are these informations stored in any other place, too?

    Rank Math stores all the data in postmeta table. The meta_key you used to save primary-category is wrong. Please use rank_math_primary_category

    
    Meta Description: update_post_meta( $post_id, 'rank_math_description', $value );
    Focus Keywords:   update_post_meta( $post_id, 'rank_math_focus_keyword', $value );
    Primary category: update_post_meta( $post_id, 'rank_math_primary_category', $value );
    

    I hope that helps. If there is anything else, please let us know.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘add rank math data by php’ is closed to new replies.