Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created November 13, 2017 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/626ac4134fce8f8d11be016029890bfd to your computer and use it in GitHub Desktop.
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
<?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 );
@E-VANCE
Copy link

E-VANCE commented Aug 3, 2021

Filter now changed to searchwp\post_stati – see v4 migration guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment