WordPress filter hook

woocommerce_search_products_post_statuses

Defined by WooCommerce and fired by 5 plugins in total, running on 7.2M+ sites between them.

“WooCommerce's filter on the statuses its product search lists, so the picker follows a site's change to it.”

How to use woocommerce_search_products_post_statuses

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_search_products_post_statuses', function( $statuses ) {
	// Change $statuses here.
	return $statuses;
}, 10, 1 );

Argument names come from Faire for WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

5 plugins that fire woocommerce_search_products_post_statuses

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_search_products_post_statuses', current_user_can( 'read_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' ) ) includes/data-stores/class-wc-product-data-store-cpt.php:2110
  2. CartFlows icon CartFlows200,000+ installs apply_filters( 'woocommerce_search_products_post_statuses', current_user_can( 'edit_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' ) ) classes/class-cartflows-product-search.php:262
  3. Faire for WooCommerce icon Faire for WooCommerce800+ installs apply_filters( 'woocommerce_search_products_post_statuses', $statuses ) src/admin/class-review-linking-wc-search.php:376
  4. Better Badge icon Better Badge600+ installs apply_filters( 'woocommerce_search_products_post_statuses', current_user_can( 'edit_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' ) ) app/Utilities/Search.php:85
  5. Custom Post Type WooCommerce Integration icon Custom Post Type WooCommerce Integration300+ installs apply_filters( 'woocommerce_search_products_post_statuses', current_user_can( 'edit_private_products' ) ? [ 'private', 'publish' ] : [ 'publish' ] ) TinyApp/Models/CPTProductDataStore.php:61

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.