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 www.domain.com/?footer-search-name=&make=Honda&model=NSX&max_year=1990&max_price=20000&location=&lat=&lng= 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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.