diff --git a/src/Search.php b/src/Search.php index e8273fe011..8d0f9a541a 100644 --- a/src/Search.php +++ b/src/Search.php @@ -251,7 +251,7 @@ function ($args) { 1 ); add_filter( - 'pre_get_posts', + 'ep_post_query_db_args', [ self::class, 'hide_password_protected_content' ], 10, 1 @@ -1091,14 +1091,14 @@ public static function exclude_page_for_posts(WP_Query $query): WP_Query /** * Exclude password protected content from ElasticPress sync. * - * @param WP_Query $query The Query ElasticPress will use to fetch the ids of posts. + * @param mixed[] $args The args ElasticPress will use to fetch the ids of posts that will be synced. * - * @return WP_Query The query with exclusion of password protected content. + * @return mixed The args with exclusion of password protected content. */ - public static function hide_password_protected_content(WP_Query $query): WP_QUERY + public static function hide_password_protected_content(array $args) { - $query->set('has_password', false); + $args['has_password'] = false; - return $query; + return $args; } }