There's a "Jobs" section on my website (custom post type), with various associated taxonomies (language spoken, type of contract, location, etc.) The website also has a very big user base (about 10 000 subscribers). These users have access to a form where they chose "jobs" criterias they are interested in, in order to receive a daily email with the list of "jobs" that correspond to their criterias.

I'd like to have your opinion on the best way to implement that functionality.

My first approach is this :

  1. Loop through all the "subscriber" users
  2. For each user, get the criterias they have chosen (language, type of contract, city, etc.)
  3. with these criterias, make a WP_Query on all the "jobs" published that day
  4. send the results by email

This function would be triggered daily thanks to wp cron.

My worry is that this is perhaps a very ressource intensive way (that's a loop executing 10 000 different wp_queries in a row!) The website is hosted on a dedicated webserver (quad core with about 8Gigs of ram)

Is there a more efficient way ?

1 Answer 1


Make the user query when the job is submitted and put all matching subscribers in a queue. At the end of the day run through the queue once and send the mails.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.