Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.