Skip to content

Enterprise Search

Identify which post statuses are indexed

Enterprise Search will automatically index all public post statuses.

Note

Use the “Protected content” feature to enable indexing for all private post statuses.

Adding or excluding post statuses to the allow list

If you want to customize the post statuses being indexed, use the ep_indexable_post_status filter.

For example, if you wanted to index all post statuses of inherit:

function mysite_indexable_post_statuses( $status ) {
     $status = array_merge( $status, [ 'inherit' ] );
     return $status;
}
add_filter( 'ep_indexable_post_status', 'mysite_indexable_post_statuses', 10, 1 );

The filter above uses a list with the below array format:

[
	'publish'
]

Alternatively, if you want to exclude certain post statuses, use the same allow list to block indexing by programatically removing the entry. For example, to prevent a post status from being indexed:

function mysite_events_indexable_post_types( $status ) {
	$deny_list = array( 'custom-post-status' );
	// unset the items with values matching the deny list
	$types = array_diff( $status, $deny_list );
	return $status;
}
add_filter( 'ep_indexable_post_status', 'mysite_events_indexable_post_status', 10, 1 );

A re-index will be required afterward to ensure that the post status does display from the previous indexing.

Last updated: April 01, 2022