diff --git a/lib/class-wp-rest-url-details-controller.php b/lib/class-wp-rest-url-details-controller.php index 69fc1bb9847658..e0482f8f0fe60f 100644 --- a/lib/class-wp-rest-url-details-controller.php +++ b/lib/class-wp-rest-url-details-controller.php @@ -383,7 +383,7 @@ private function build_cache_key_for_url( $url ) { * @return mixed The value from the cache. */ private function get_cache( $key ) { - return get_transient( $key ); + return get_site_transient( $key ); } /** @@ -406,7 +406,7 @@ private function set_cache( $key, $data = '' ) { */ $cache_expiration = apply_filters( 'rest_url_details_cache_expiration', $ttl ); - return set_transient( $key, $data, $cache_expiration ); + return set_site_transient( $key, $data, $cache_expiration ); } /** diff --git a/phpunit/class-wp-rest-url-details-controller-test.php b/phpunit/class-wp-rest-url-details-controller-test.php index 901e83052356ec..2801044f689211 100644 --- a/phpunit/class-wp-rest-url-details-controller-test.php +++ b/phpunit/class-wp-rest-url-details-controller-test.php @@ -277,11 +277,11 @@ function( $args, $url ) { public function test_will_return_from_cache_if_populated() { $transient_name = 'g_url_details_response_' . md5( static::$url_placeholder ); - remove_filter( "pre_transient_{$transient_name}", '__return_null' ); + remove_filter( "pre_site_transient_{$transient_name}", '__return_null' ); // Force cache to return a known value as the remote URL http response body. add_filter( - "pre_transient_{$transient_name}", + "pre_site_transient_{$transient_name}", function() { return '