Skip to content

Instantly share code, notes, and snippets.

@rmorse
Last active November 3, 2015 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmorse/074db89682afa8501b15 to your computer and use it in GitHub Desktop.
Save rmorse/074db89682afa8501b15 to your computer and use it in GitHub Desktop.
Search & Filter Pro - Filter - sf_edit_query_args
<?php
/*
Takes 2 paramaters -
$query_args - an array of query arguments - this is the same as teh `$args` variable that gets passed to to `WP_Query`- https://codex.wordpress.org/Class_Reference/WP_Query
$sfid - this is the numeric ID of the Search Form
Make sure to return $query_args after you have modified it as with all WP filters
*/
function sf_filter_query_args( $query_args, $sfid ) {
//if search form ID = 225, the do something with this query
if($sfid==225)
{
//modify $query_args here before returning it
}
return $query_args;
}
add_filter( 'sf_edit_query_args', 'sf_filter_query_args', 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment