Auto focus Keyword with Wpematico with ACF

#1037385
  • Resolved Naosedizioni
    Rank Math free

    Hi
    I installed Rank Math instead of Yoast and I am finding it wonderful. I would like to add the keyword automatically to a WpeMatico feed campaign with ACF.
    Thanks for your support.
    Regards
    Paolo

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you are facing. To automatically set focus keywords from your ACF fields in a WPeMatico feed campaign, you can use a code snippet similar to the one provided in our documentation for integrating ACF with Rank Math. Here’s a general approach you can take:

    1. Navigate to the Theme File Editor: Go to Appearance → Theme File Editor in your WordPress dashboard.
      Navigate to the Theme File Editor

    2. Add the Code Snippet: You can add a custom function that retrieves the ACF field and sets it as the focus keyword. Here’s an example code snippet:

      function update_focus_keywords() {
         $posts = get_posts(array(
             'posts_per_page' => -1,
             'post_type'      => 'post', // replace post with your post type.
         ));
         foreach ($posts as $p) {
             // Replace 'your_acf_field_name' with your actual ACF field name.
             if (!get_post_meta($p->ID, 'rank_math_focus_keyword', true) && function_exists('get_field') && (null !== get_field('your_acf_field_name', $p->ID))) {
                 update_post_meta($p->ID, 'rank_math_focus_keyword', strtolower(get_field('your_acf_field_name', $p->ID)));
             }
         }
      }
      add_action('init', 'update_focus_keywords');

      Make sure to replace 'your_acf_field_name' with the actual name of your ACF field.

    3. Update the File: After adding the code snippet, click on the Update File button to save your changes.
      Update the file

    This code will check if the focus keyword is set for each post and, if not, it will update it using the value from the specified ACF field.

    If you need more advanced assistance or want to ensure everything is set up correctly, we recommend our professional setup service for users with a PRO subscription. This service can help ensure your plugin setup adheres to the latest SEO standards.

    Thank you for raising this concern! If you have any further questions or need additional help, feel free to reply to this ticket, and a human agent will assist you further.

    Sources:
    Is There a Way to Use ACF for Focus Keywords? » Rank Math

    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.

Viewing 1 replies (of 1 total)

The ticket ‘Auto focus Keyword with Wpematico with ACF’ is closed to new replies.