Save Search Criteria notification

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!

Read more here:: Save Search Criteria notification

Leave a Reply

Your email address will not be published. Required fields are marked *