Enabling SuperCache using RestAPI
-
Hi I’m using the RestAPI to enable SuperCache.
I m submitting a POST request to /wp-json/wp-super-cache/v1/settings URL with the data “{ easy => true }”
POST /wp-json/wp-super-cache/v1/settings { "easy": true }
After adding some debug to the /class.wp-super-cache-rest-update-settings.php file I can confirm that the toggle_easy_caching function is called and that “wp_super_cache_enable();” is also called
protected function toggle_easy_caching( $enabled = true ) { global $cache_path, $wp_cache_shutdown_gc, $cache_schedule_type; if ( $enabled ) { // return rest_ensure_response( array( "easy" => "enabling it...." ) ); $settings = array( 'wp_cache_mobile_enabled' => 1, 'is_cache_enabled' => 1, 'cache_rebuild_files' => 1, 'cache_compression' => 0, 'wp_cache_not_logged_in' => 2, ); wp_cache_enable(); //return rest_ensure_response( array( "easy" => "463" ) ); if ( ! defined( 'DISABLE_SUPERCACHE' ) ) { return rest_ensure_response( array( "easy" => "465" ) ); wp_cache_debug( 'DISABLE_SUPERCACHE is not set, super_cache enabled.' ); wp_super_cache_enable(); } wpsc_set_default_gc(); }
But when going back to the wp-admin UI the radio is still set to “Caching Off”. What am I missing? What additional steps need to be performed to enable the plugin using the API?
The API reply contains the following fields:
... # is_cache_enabled => 1 # is_super_cache_enabled => 1 ...
Note: I double checked that DISABLE_SUPERCACHE was not set.
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Enabling SuperCache using RestAPI’ is closed to new replies.