WP_Super_Cache_Rest_Delete_Cache::callback()
Get a collection of items
Method of the class: WP_Super_Cache_Rest_Delete_Cache{}
No Hooks.
Return
WP_Error|WP_REST_Response
.
Usage
$WP_Super_Cache_Rest_Delete_Cache = new WP_Super_Cache_Rest_Delete_Cache(); $WP_Super_Cache_Rest_Delete_Cache->callback( $request );
- $request(WP_REST_Request) (required)
- Full data about the request.
WP_Super_Cache_Rest_Delete_Cache::callback() WP Super Cache Rest Delete Cache::callback code WPSCache 1.12.4
public function callback( $request ) { $params = $request->get_json_params(); if ( isset( $params['id'] ) && is_numeric( $params['id'] ) ) { wpsc_delete_post_cache( $params['id'] ); } elseif ( !empty( $params['expired'] ) ) { global $file_prefix; wp_cache_clean_expired( $file_prefix ); } elseif ( isset( $params['url'] ) ) { global $cache_path; $directory = $cache_path . 'supercache/' . $params[ 'url' ]; wpsc_delete_files( $directory ); prune_super_cache( $directory . '/page', true ); } else { global $file_prefix; wp_cache_clean_cache( $file_prefix, !empty( $params['all'] ) ); } return rest_ensure_response( array( 'Cache Cleared' => true ) ); }