Created
November 13, 2017 13:07
-
-
Save jchristopher/626ac4134fce8f8d11be016029890bfd to your computer and use it in GitHub Desktop.
Allow SearchWP to index Draft posts and make them searchable in the WordPress Admin, not public
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 | |
function my_searchwp_post_statuses( $post_status, $engine ) { | |
if ( is_admin() || did_action( 'searchwp_indexer_pre' ) ) { | |
$post_status = array( 'publish', 'draft' ); | |
} | |
return $post_status; | |
} | |
add_filter( 'searchwp_post_statuses', 'my_searchwp_post_statuses', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Filter now changed to
searchwp\post_stati
– see v4 migration guide.