/** * 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); } }
public static function argPostStatus(Query $query, $value, &$q) { if ($value == 'any') { $ips = Indexer::getIndexablePostStati(); $query->where('post_status', $ips); } else { $query->where('post_status', $value); } }