How to use Wordpress to run a task?

H there,

I have a list of hundreds of email addresses that I’d like to update programatically. To do that, I’m making an API request using PHP to pull a JSON file with all contacts I have and since there’s a ton of email addresses, the file is divided in several pages.

The code does exactly what I want, but the issue is that the script times out after a few pages and I think that’s because I’m included the script in the wp-includes directory of my Wordpress installation and simply enter it in the browser.

All I really have available is a ubuntu server from DigitalOcean with Wordpress installed. I need to update all those emails and that server is the only resource I have available.

I’ve read something about cronjobs and as far as I understood, that’s what I need in order to complete my task, but I have no idea how to execute it in my server or in my Wordpress installation.

Can anybody assist in what I need to do, please?

I don’t know about WP, but do you have access to Cpanel? It’s quite straightforward to set up cron jobs there.

It is usual to place cron scripts in a folder that is not accessible to the web so that it is not run, accidentally or maliciously, from a browser.

Are you able to tell me if this is it?

I’ll give it a try, but I’m trying to anticipate any issues: my script will have to be in the same directory where Wordpress is, right? Won’t I have the same timeout issue I was having before?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.