Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Plugin Name: Swift Performance Tweaks
- */
- add_shortcode('swift_clear_user_cache', function(){
- $current_page = site_url(str_replace(home_url(), '', 'http'.(isset($_SERVER['HTTPS']) ? 's' : '') . '://' . Swift_Performance::$http_host . $_SERVER['REQUEST_URI']));
- return '<a href="' . wp_nonce_url($current_page, 'swift-clear-user-cache', 'swift-clear-user-cache') . '">Clear user cache</a>';
- });
- add_action('init', function(){
- if (isset($_REQUEST['swift-clear-user-cache']) && wp_verify_nonce($_REQUEST['swift-clear-user-cache'], 'swift-clear-user-cache') && class_exists('Swift_Performance_Cache')){
- Swift_Performance_Cache::clear_user_cache(get_current_user_id());
- }
- });
- ?>
Add Comment
Please, Sign In to add comment