Automate the Insertion of Focus Keyword

#537691
  • hello
    I’m following this guide:
    https://rankmath.com/kb/how-to-automate-the-insertion-of-focus-keyword/

    where allegedly adding a piece of code into functions.php converts all my post titles into keywords…but whenever i do so, i get a wp critical error.
    I also get the same critical error when trying to apply the code with the “code snippets” plugin.
    I tried the creation of a rank-math php file method but that kept on givig me the code stuck to the header.. i mean it was visible in my site’s header.

    I contacted my host for help, deactivated all plugins but its still returning errors because as they told me its consuming all of my php memory.
    could you possibly help me out with this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

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

    As the host confirmed that you are running out of resources, then you will have to run the code in batches of 100.

    To do this, replace the line 'posts_per_page' => -1, with the following line 'posts_per_page' => 100,. Save the code snippet, so that the first 100 products are process.

    Next, below the line 'posts_per_page' => 100, add the following line: 'offset' => 100 and save the code. This will process the next 100 products. Repeat the last step to offset the processed posts by 100 again: 'offset' => 200. You will have to repeat this 17 times until all your products are processed.

    Hope that helps. Please let us know if you have questions.

    Thank you

    Thank you for the response
    Since my site is quite large.. 50.000+ articles and seeing you mentioned 100. Can I raise the number to 1000 or do I have to repeat the action 500+ times?

    Hello,

    Yes, you can try with 500 and see if it goes fine. If it doesn’t you would need to reduce the number.

    Hope this helps. Let us know how this goes.

    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 ‘Automate the Insertion of Focus Keyword’ is closed to new replies.