My solution: generate a backtrace in the function and bail early if called from validate_active_plugins()
.
function action_option_active_plugins( $value, $option ) {
// Look at the call backtrace and bail early if called from validation function.
$backtrace = debug_backtrace( 2 ); // Exclude ['object'] and ['args']
foreach( $backtrace as $frame ) {
if( $frame['function'] === 'validate_active_plugins' ) {
return $value;
}
}
//Do other stuff with $value...
return $value;
}
add_filter( 'option_active_plugins', 'wpcom_vip_option_active_plugins', 10, 2 );