Skip to content

Instantly share code, notes, and snippets.

@mehrshaddarzi
Last active December 12, 2023 05:08
Show Gist options
  • Save mehrshaddarzi/6cee66cb4b189a5cdd577b9a00cd2b54 to your computer and use it in GitHub Desktop.
Save mehrshaddarzi/6cee66cb4b189a5cdd577b9a00cd2b54 to your computer and use it in GitHub Desktop.
Disable WordPress plugin
<?php
/*
* Plugin Name: Activate Plugins
*/
add_filter( 'option_active_plugins', function ( $plugins ) {
$actual_link = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if(strtoupper($_SERVER['REQUEST_METHOD']) == "POST" and strpos($actual_link, 'admin-ajax.php') !== false and isset($_POST['action']) and $_POST['action'] == "irk_quick_cart"){
return ['woocommerce/woocommerce.php'];
}
return $plugins;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment