Skip to content

Instantly share code, notes, and snippets.

@blobaugh
Created November 28, 2018 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blobaugh/f126bd0f06a36aeeabc8e394f0640700 to your computer and use it in GitHub Desktop.
Save blobaugh/f126bd0f06a36aeeabc8e394f0640700 to your computer and use it in GitHub Desktop.
<?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