Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utility function for checking if a request should be integrated. #2267

Merged
merged 11 commits into from
Aug 23, 2021
Prev Previous commit
Next Next commit
Merge branch 'develop' into fix/2148
  • Loading branch information
JakePT committed Aug 23, 2021
commit 7d6acd85e5c797c1f5c0504e82122bbc688343b8
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public function setup() {
add_filter( 'ep_indexable_post_types', [ $this, 'post_types' ], 10, 1 );
add_filter( 'ep_admin_wp_query_integration', '__return_true' );
add_action( 'pre_get_posts', [ $this, 'integrate' ] );

if ( Features::factory()->get_registered_feature( 'comments' )->is_active() ) {
add_filter( 'ep_indexable_comment_status', [ $this, 'get_comment_statuses' ] );
add_action( 'pre_get_comments', [ $this, 'integrate_comments_query' ] );
}
}

/**
Expand Down Expand Up @@ -182,6 +187,10 @@ public function integrate( $query ) {
* @since 3.6.0
*/
public function integrate_comments_query( $comment_query ) {
if ( ! Utils\is_integrated_request( $this->slug, [ 'admin' ] ) ) {
return;
}

// Lets make sure this doesn't interfere with the CLI
if ( defined( 'WP_CLI' ) && WP_CLI ) {
return;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.