Hello,
We apologize for the issue you are facing with the rank_math_focus_keyword
not being applied automatically when posting via the WordPress API. This behavior can occur because Rank Math may not trigger its internal processes to update the SEO score and data when changes are made directly through the API.
To ensure that the rank_math_focus_keyword
is applied automatically, you might need to implement a custom solution that triggers the necessary hooks or actions after updating the post via the API. Here’s a general approach you can consider:
-
Use the save_post
Hook: You can create a function that hooks into save_post
to ensure that Rank Math processes the focus keyword whenever a post is saved via the API. This function can be added to your theme’s functions.php
file or a custom plugin.
add_action('save_post', 'update_rank_math_data', 10, 3);
function update_rank_math_data($post_id, $post, $update) {
// Check if it's a valid post type and if Rank Math is active
if (get_post_type($post_id) === 'post' && function_exists('rank_math')) {
// Trigger Rank Math's internal functions to recalculate SEO data
rank_math()->meta->update_meta($post_id);
}
}
-
Ensure Proper API Usage: Make sure that when you are updating the rank_math_focus_keyword
, you are also sending any other necessary data that Rank Math might require to process the SEO score correctly.
-
Check for Conflicts: Sometimes, other plugins or themes may conflict with how Rank Math processes data. Ensure that there are no such conflicts by testing with other plugins disabled.
If these suggestions do not resolve the issue, please reply to this ticket with more details about your setup, including any relevant code snippets you are using for the API calls. A human agent from the Rank Math Support team will be able to assist you further.
Thank you for raising this concern!
This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.
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.