Save Search Criteria notification

by Matt H   Last Updated August 09, 2018 17:08 PM

I am trying to simply figure out how, after a user has saved a search on my site and wishes to get notified if anything new matching that search criteria has been added, can I then re-run the saved search (the search parameters are saved in the database as such for example).

Here is my current php function but it's still in it's infancy, I am wondering how do I write the WP_Query part to properly search my site using the above url string as an example.

function run_search_query() {

global $wpdb;

/*$query_args = array(
'post_type' => 'adverts',
'posts_per_page' => '-1'
$run_search = new WP_Query($query_args);*/

$requests = $wpdb->get_results( "SELECT * FROM search_queries");

foreach($requests as $request) {
return $request->search_parameter;

I'm trying to implement a save search system but I can't figure out the part of the equation that runs the search again every X hours and notifies the user if there's a new addition matching their saved search. Any help would be greatly appreciated regarding this whole system set up, not just the above question. Thanks in advance!

Related Questions

Click loads template via ajax

Updated August 06, 2015 17:03 PM

Multiple Notifications SetInterval

Updated July 11, 2018 00:08 AM

dynamic dependent select dropdown

Updated July 24, 2018 17:08 PM