WP_Super_Cache_Rest_Update_Settings::set_super_cache_enabled()
Method of the class: WP_Super_Cache_Rest_Update_Settings{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->set_super_cache_enabled( $value );
- $value(mixed) (required)
- -
WP_Super_Cache_Rest_Update_Settings::set_super_cache_enabled() WP Super Cache Rest Update Settings::set super cache enabled code WPSCache 1.12.4
protected function set_super_cache_enabled( $value ) { global $wp_cache_mod_rewrite; if ( is_numeric( $value ) == false ) { $types = array( 'wpcache' => 0, 'mod_rewrite' => 1, 'PHP' => 2 ); if ( isset( $types[ $value ] ) ) { $value = $types[ $value ]; } else { return false; } } if ( $value === 0 ) { // WPCache wp_super_cache_disable(); } else { wp_super_cache_enable(); $wp_cache_mod_rewrite = 0; // PHP recommended if ( $value == 1 ) { // mod_rewrite $wp_cache_mod_rewrite = 1; add_mod_rewrite_rules(); } elseif( $value == 2 ) { // PHP $wp_cache_mod_rewrite = 0; remove_mod_rewrite_rules(); } wp_cache_setting( 'wp_cache_mod_rewrite', $wp_cache_mod_rewrite ); } return true; }