Last active
December 8, 2024 02:11
-
-
Save nawawi/96a96ae658cf5f5cce2e449b516c50ab to your computer and use it in GitHub Desktop.
Prevent docket-cache from being activated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Disable wp-content/object-cache.php | |
if (!defined('DOCKET_CACHE_DISABLED')) { | |
define('DOCKET_CACHE_DISABLED', true); | |
} | |
// Deactivate docket-cache | |
add_action('docketcache/init', function ($docket_cache_instance) { | |
try { | |
(new Nawawi\DocketCache\Event($docket_cache_instance))->unregister(); | |
if (!function_exists('deactivate_plugins')) { | |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
} | |
deactivate_plugins('docket-cache/docket-cache.php', true); | |
if (file_exists(WP_CONTENT_DIR . '/.object-cache-delay.txt')) { | |
unlink(WP_CONTENT_DIR . '/.object-cache-delay.txt'); | |
} | |
if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) { | |
unlink(WP_CONTENT_DIR . '/object-cache.php'); | |
} | |
} catch (\Throwable $e) { | |
} | |
}, PHP_INT_MAX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment