diff --git a/CHANGELOG.md b/CHANGELOG.md index bffde64c..548d96a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This is an alpha version! The changes listed here are not final. - Super Cache: tell user that Cache module of Boost must be deactivated to use WPSC - Updated package dependencies. +### Fixed +- Super Cache: remove the preload interval based on the post count. Preload as often as you want. + ## [1.12.1] - 2024-05-09 ### Changed - General: update WordPress version requirements to WordPress 6.4. [#37047] diff --git a/partials/preload.php b/partials/preload.php index 6430997b..34b8cbb6 100644 --- a/partials/preload.php +++ b/partials/preload.php @@ -14,11 +14,8 @@ } $count = wpsc_post_count(); -if ( $count > 1000 ) { - $min_refresh_interval = 720; -} else { - $min_refresh_interval = 30; -} + +$min_refresh_interval = wpsc_get_minimum_preload_interval(); echo '
'; echo '

' . __( 'This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache' ) . '

'; diff --git a/wp-cache.php b/wp-cache.php index c4c94a9f..d45e5363 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -1062,13 +1062,7 @@ function toggleLayer( whichLayer ) { if ( 'preload' === $curr_tab ) { if ( true == $super_cache_enabled && ! defined( 'DISABLESUPERCACHEPRELOADING' ) ) { global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_taxonomies, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb; - $count = wpsc_post_count(); - if ( $count > 1000 ) { - $min_refresh_interval = 720; - } else { - $min_refresh_interval = 30; - } - wpsc_preload_settings( $min_refresh_interval ); + wpsc_preload_settings(); $currently_preloading = false; echo '
'; @@ -3945,7 +3939,18 @@ function wpsc_post_count() { return $count; } -function wpsc_preload_settings( $min_refresh_interval = 'NA' ) { + +/** + * Get the minimum interval in minutes between preload refreshes. + * Filter the default value of 10 minutes using the `wpsc_minimum_preload_interval` filter. + * + * @return int + */ +function wpsc_get_minimum_preload_interval() { + return apply_filters( 'wpsc_minimum_preload_interval', 10 ); +} + +function wpsc_preload_settings() { global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_taxonomies, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb; if ( isset( $_POST[ 'action' ] ) == false || $_POST[ 'action' ] != 'preload' ) @@ -3965,14 +3970,7 @@ function wpsc_preload_settings( $min_refresh_interval = 'NA' ) { return; } - if ( $min_refresh_interval == 'NA' ) { - $count = wpsc_post_count(); - if ( $count > 1000 ) { - $min_refresh_interval = 720; - } else { - $min_refresh_interval = 30; - } - } + $min_refresh_interval = wpsc_get_minimum_preload_interval(); // Set to true if the preload interval is changed, and a reschedule is required. $force_preload_reschedule = false;