public static function getIndexablePostTypes() { if (Config::option('index_private_post_types')) { return get_post_types(); } return get_post_types(['exclude_from_search' => false]); }
/** * Hooked on save_post. Called when a post is updated. * * @param int $postID */ public static function actionSavePost($postID) { global $importer; // If we have an importer we must be doing an import - let's abort if (!empty($importer)) { return; } $post = get_post($postID); if (!in_array($post->post_status, Indexer::getIndexablePostStati())) { // The post is not indexable but might have been. Try to delete. $indexer = new Indexer(); $indexer->deletePost($post->ID); return; } if (in_array($post->post_type, Indexer::getIndexablePostTypes())) { do_action('esi_before_post_save', $post); $indexer = new Indexer(); $indexer->indexPost($post); } }