Tell SearchWP to index WooCommerce Orders https://searchwp.com/docs/kb/searching-woocommerce-orders/
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 | |
/** | |
* Tell SearchWP that it can index WooCommerce Orders. | |
*/ | |
add_filter( 'searchwp_indexed_post_types', function( $post_types ) { | |
if ( ! is_array( $post_types ) ) { | |
$post_types = (array) $post_types; | |
} | |
if ( ! in_array( 'shop_order', $post_types ) ) { | |
$post_types[] = 'shop_order'; | |
} | |
return $post_types; | |
} ); | |
/** | |
* Tell SearchWP to index all WooCommerce Order post statuses. | |
*/ | |
add_filter( 'searchwp_post_statuses', function( $post_statuses, $engine ) { | |
if ( ! is_array( $post_statuses ) ) { | |
$post_statuses = (array) $post_statuses; | |
} | |
return array_unique( array_merge( $post_statuses, array( | |
'wc-pending', | |
'wc-processing', | |
'wc-on-hold', | |
'wc-completed', | |
'wc-cancelled', | |
'wc-refunded', | |
'wc-failed', | |
) ) ); | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment