action hook. * * @since 4.7.1 * * @return void */ public function filterPostsAfterChangingClauses() { remove_action( 'wp', [ $this, 'filterPostsAfterChangingClauses' ] ); global $wp_query; if ( ! empty( $wp_query->posts ) && is_array( $wp_query->posts ) ) { $wp_query->posts = array_filter( $wp_query->posts, function ( $post ) { return aioseo()->helpers->isTruSeoEligible( $post->ID ); } ); // Update `post_count` for pagination. if ( isset( $wp_query->post_count ) ) { $wp_query->post_count = count( $wp_query->posts ); } } } }