Last active
November 3, 2015 16:21
-
-
Save rmorse/074db89682afa8501b15 to your computer and use it in GitHub Desktop.
Search & Filter Pro - Filter - sf_edit_query_args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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