diff --git a/inc/class-archiveless.php b/inc/class-archiveless.php index b6b846b1..d581cb46 100644 --- a/inc/class-archiveless.php +++ b/inc/class-archiveless.php @@ -67,6 +67,10 @@ protected function __construct() { add_action( 'save_post', [ $this, 'save_post' ] ); add_action( 'wp_head', [ $this, 'on_wp_head' ] ); + // Third-party plugin support. + add_filter( 'ep_indexable_post_status', [ $this, 'filter__elasticsearch_indexable_post_statuses' ] ); + add_filter( 'sp_config_sync_statuses', [ $this, 'filter__elasticsearch_indexable_post_statuses' ] ); + if ( is_admin() ) { add_action( 'post_submitbox_misc_actions', [ $this, 'add_ui' ] ); add_action( 'add_meta_boxes', [ $this, 'fool_edit_form' ] ); @@ -76,6 +80,18 @@ protected function __construct() { } } + /** + * Add the `archiveless` post status to the list of indexable post statuses. + * + * @see + * + * @param string[] $post_statuses The list of indexable post statuses. + * @return string[] + */ + public function filter__elasticsearch_indexable_post_statuses( $post_statuses ): array { + return array_unique( array_merge( $post_statuses, [ self::$status ] ) ); + } + /** * Instance method. Initializes the instance, if not done already, and returns it. *