From c3ce556914fbfcf88f326f27a4327abec92735bb Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Wed, 14 Jun 2023 11:55:42 -0600 Subject: [PATCH] Move infinite scroll limit to 1000 --- performance/vip-tweaks.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/performance/vip-tweaks.php b/performance/vip-tweaks.php index 1cdee31094..3623f73867 100644 --- a/performance/vip-tweaks.php +++ b/performance/vip-tweaks.php @@ -150,3 +150,10 @@ function wpcom_vip_maybe_bust_available_months_cache( $post_id ) { wp_cache_delete( $cache_key, 'vip' ); } } + +/** + * Set a max limit on posts_per_page for an infinite scroll request to prevent client-side abuse. + */ +add_filter( 'infinite_scroll_posts_per_page', function( $posts_per_page ) { + return min( (int) $posts_per_page, 1000 ); +} );