Continue reading WPML and category exclusions

WPML and category exclusions

Relevanssi category exclusion setting doesn’t work properly with WPML. Here’s a bit of code from Srdjan Jocić from OnTheGoSystems that fixes it. Just add this to your theme functions.php. add_filter( ‘relevanssi_search_filters’, ‘wpml_relevanssi_include_exclude_cats_fix’ ); function wpml_relevanssi_include_exclude_cats_fix( $args ) { if ( array_key_exists( ‘tax_query’, $args ) && did_action( ‘wpml_loaded’ ) ) {   foreach ( $args[’tax_query’] as…

Read more WPML and category exclusions 0 Comment on WPML and category exclusions
Continue reading Using AND and NOT for Boolean operators

Using AND and NOT for Boolean operators

Relevanssi Premium has support for in-query Boolean operators. Relevanssi uses + and – for the operators: cats -dogs and cats +kittens. If you prefer instead to use the verbal AND and NOT operators, it only takes one small function in your theme functions.php: add_filter(’relevanssi_search_filters’, ‘rlv_boolean_operators’); function rlv_boolean_operators($args) { $args[’q’] = str_replace(’ and ‘, ‘ +’,…

Read more Using AND and NOT for Boolean operators 4 Comments on Using AND and NOT for Boolean operators