WooCommerce: Hidden products in search
…want to block from the search to true. Older Relevanssi versions and WooCommerce 3 WooCommerce 3 uses taxonomy terms to handle visibility. You can create a relevanssi_do_not_index filter function for these: add_filter( ‘relevanssi_do_not_index’, ‘rlv_wc3_hidden_filter’, 10, 2 ); function rlv_wc3_hidden_filter( $block, $post_id ) { if ( has_term( array( ‘exclude-from-catalog’, ‘exclude-from-search’, ‘outofstock’……products from the search. This method leads to much faster indexing times. Add this to your site: add_filter( ‘relevanssi_woocommerce_indexing’, ‘rlv_woocommerce_filter’ ); function rlv_woocommerce_filter( $blocks ) { $blocks[‘outofstock’] = true; $blocks[‘exclude-from-catalog’] = true; $blocks[‘exclude-from-search’] = true; return $blocks; } There’s one key for each product visibility level, set the ones you……), ‘product_visibility’, $post_id ) ) { $block = true; } return $block; } This code will unindex products that are set to be excluded from the catalogue, excluded from search or that are out of stock. If you want to keep out of stock items in the search results, just…