Auto Insertion Focus Keywords- High Resource Usage

#326912
  • Resolved Arnab Sen
    Rank Math free

    Hi,

    I was trying auto insertion of focus keyword & it was working perfectly. But my site has around 2 lakh posts currently so my resource usage went extremely high. Please suggest a solution.

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

    Hello,

    Thank you for contacting Rank Math, and sorry for any inconvenience caused.

    You can limit the number of posts that you process each time is by setting a limit on the posts like so:

    'posts_per_page' => 100
    

    You can then add an offset to the function as well to continue adding the focus keywords to newer posts. So, after changing the first 100 posts you add an offset of 100 to the function like so:

    'offset' => 100
    

    You can continue to increase the offset by 100 until it runs through all of the posts.

    Each time you run the function, you can add 100 to the offset value like,

    1st time : 'offset' => 0, 
    2nd time : 'offset' => 100,
    3rd time : 'offset' => 200,
    
    And so on...

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    Thanks for quick response.

    Can you please help me with the code if I have to apply auto insertion only for new posts from now onwards.

    Hello,

    By default, the get_posts() function retrieves the latest posts from your custom post type so you can set the post_per_page to at least 100 and set the offset to 0. Or, you can refer to my code below:

    $posts = get_posts( array(
        'posts_per_page' => 100,
        'offset' => 0,
        "orderby" => 'date',
        "order" => 'DESC',
        'post_type' => 'post'
    ));

    So the auto insertion of your focus keyword will process in the first 100 newest posts.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    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 ‘Auto Insertion Focus Keywords- High Resource Usage’ is closed to new replies.