Hi @bizbergthemes
Thank you for using our plugin!
We just released a new version of our plugin, which should solve this issue.
I have updated the plugin but it not generating the expired cache. The problem is in includes/caching/class-caching.php.
public function regenerate_expired_caches() {
global $wpdb;
$regenerate_number = (int) $this->get_regenerate_number();
$sql =
"SELECT *
FROM {$this->db_table_caches}
WHERE cache_type = 'endpoint'
ORDER BY cache_hits DESC";
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$results = $wpdb->get_results( $sql, ARRAY_A );
foreach ( $results as &$result ) {
if ( 1 === strtotime( $result['expiration'] ) || false === get_transient( $this->transient_key( $result['cache_key'] ) ) ) {
// Regenerate.
$url = Util::get_home_url() . $result['request_uri'];
$return = wp_remote_get(
$url,
[
'timeout' => 10,
'sslverify' => false,
'headers' => json_decode( $result['request_headers'], true ),
]
);
--$regenerate_number;
if ( $regenerate_number <= 0 ) {
break;
}
}
}
}
The problem is in this code $url = Util::get_home_url() . $result['request_uri'];
in multisite the link is like this https://example.com/wordpress/wordpress/wp-json/v1/…… if i print $url but it should be https://example.com/wordpress/wp-json/v1/……
Hi @bizbergthemes
Maybe I should have mentioned you have to delete all old caches first, because they are saved with the wrong request uri in the database. So in your example it is saved as /wordpress/wp-json/... where it should be saved as /wp-json/...
Sorry for not mentioning that yesterday.