Disable LiteSpeed Cache & Rank Math SEO at frontend checkout
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
//disable_plugins_for_specific_url add_filter('option_active_plugins', function ($plugins) { $disabled_url = "phone-orders-frontend-page"; //EDIT // Check if the current URL is one of the specified URLs if (strpos($_SERVER['REQUEST_URI'], $disabled_url) !== false) { // Plugins you want to disable on this URL // You need to know the folder and main file name of the plugins $plugins_to_disable = array( 'litespeed-cache/litespeed-cache.php', // Example plugin path 'seo-by-rank-math/rank-math.php', // Adjust the plugin path accordingly 'seo-by-rank-math-pro/rank-math-pro.php' // Make sure the plugin base path is correct ); // Loop through the list of plugins to disable and remove them from the active plugins list foreach ($plugins_to_disable as $plugin) { $key = array_search($plugin, $plugins); if (false !== $key) { unset($plugins[$key]); } } } return $plugins; }); |