Created
November 28, 2018 21:41
-
-
Save blobaugh/f126bd0f06a36aeeabc8e394f0640700 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// Ensure we are only looking at api requests | |
if ( ! defined( 'REST_REQUEST' ) ) { | |
// No API request. Bail out | |
return; | |
} | |
/** | |
* If the WP API is being called, we want to deactivate the Sucuri plugin. | |
* This will remove the plugin only on this call. No need to alter the database. | |
*/ | |
add_action( 'option_active_plugins', function( $plugins ) { | |
// Find the Sucuri plugin array key | |
$key = array_search( 'sucuri-scanner/sucuri.php', $plugins ); | |
// Remove it from the plugin list | |
if ( false !== $key ) { | |
unset( $plugins[$key] ); | |
} | |
return $plugins; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment