Need Run scripts in background

[ad_1]

Hi guys. Do you know a good way to run a function in the background to avoid affecting frontend performance? I created a script to create 1000 products in WooCommer, but it is too slow. I also created a cron function, but I want to run the function anytime I need it. I appreciate any help.

[ad_2]
1 Comment
  1. modify the script to add products in batches. put the script to sleep for 1/5/10 seconds after every 10/20/50 items (find the optimal values through trial and error). the script will take much longer to complete but shouldn’t overwhelm server resources.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer