public function action_the_post($post) { if (!is_multisite()) { return; } if (empty($this->query_stack)) { return; } if (!ep_elasticpress_enabled($this->query_stack[0]) || apply_filters('ep_skip_query_integration', false, $this->query_stack[0])) { return; } if (!empty($post->site_id) && get_current_blog_id() != $post->site_id) { restore_current_blog(); switch_to_blog($post->site_id); remove_action('the_post', array($this, 'action_the_post'), 10, 1); setup_postdata($post); add_action('the_post', array($this, 'action_the_post'), 10, 1); } }