diff --git a/src/rest-api/stats/class-endpoint-posts.php b/src/rest-api/stats/class-endpoint-posts.php index 9de89a235f..f22dd5d184 100644 --- a/src/rest-api/stats/class-endpoint-posts.php +++ b/src/rest-api/stats/class-endpoint-posts.php @@ -326,6 +326,17 @@ public function get_posts( WP_REST_Request $request ) { $params['urls'] = $new_urls; } + if ( isset( $params['urls'] ) && is_array( $params['urls'] ) ) { + /** + * Allow adjustments to post URLs before request. Useful for testing non-local URLs, or mirroring site content. + * + * @since 3.19.1 + * + * @param array $urls The URLs to be used in the request. + */ + $params['urls'] = apply_filters( 'wp_parsely_stats_posts_urls', $params['urls'] ); + } + // Build the request params. $request_params = array( 'period_start' => $params['period_start'] ?? null,