Created
March 2, 2014 18:49
-
-
Save jchristopher/9311560 to your computer and use it in GitHub Desktop.
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 | |
function searchwp_include_only_tax_term( $ids, $engine, $terms ) { | |
// if mycat is the GET variable in use, we want to limit to a specific custom taxonomy term | |
if( isset( $_GET['mycat'] ) ) { | |
$my_taxonomy = 'my_taxonomy'; // taxonomy name | |
$my_term = absint( $_GET['mycat'] ); // taxonomy term as defined by form submission | |
$args = array( $my_taxonomy => $my_term, 'fields' => 'ids' ); | |
$ids = get_posts( $args ); | |
} | |
return $ids; | |
} | |
add_filter( 'searchwp_include', 'searchwp_include_only_tax_term', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment