Created
March 3, 2017 12:34
-
-
Save DavidCramer/ab5bbd7087343124fd4d326109b6e644 to your computer and use it in GitHub Desktop.
exclude indexing if term is present
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 | |
// add the below code to your child themes functions.php file. | |
function fwps_terms_exclude_index( $params ) { | |
// add your terms in here | |
$terms = array( | |
'expluded-term', | |
'anotehr-expluded' | |
); | |
/// set the name of your facet | |
if ( 'price' == $params['facet_name'] ) { | |
// can change the product_cat to any term to check | |
if( has_term( $terms, 'product_cat', $params['post_id'] ) ){ | |
return false; | |
} | |
} | |
return $params; | |
}; | |
add_filter( 'facetwp_index_row', 'fwps_terms_exclude_index' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment