How to Overwrite validate_plugin function
How can I overwrite the WordPress validate_plugin
function. I need to disable that function alone for my plugin, and it should not affect any other plugin.
I don't want the validate_plugin function for my plugin right now, I couldn't find a declared hook, do_action
or apply_filter
, within the function in the wp-admin/includes/plugin.php
file.
?php
function run_activate_plugin( $plugin ) {
$current = get_option( 'active_plugins' );
$plugin = plugin_basename( trim( $plugin ) );
if ( !in_array( $plugin, $current ) ) {
$current[] = $plugin;
sort( $current );
do_action( 'activate_plugin', trim( $plugin ) );
update_option( 'active_plugins', $current );
do_action( 'activate_' . trim( $plugin ) );
do_action( 'activated_plugin', trim( $plugin) );
}
return null;
}
run_activate_plugin( 'plugin/subfolder/plugin.php');
?
If i activate the plugin from subfolder it got deactivate because of that above function. So that the reason i want to disable the validate_plugin function for my plugin alone.
run_activate_plugin( 'plugin/subfolder/plugin.php');
Generally run_activate_plugin argument is to be look like
run_activate_plugin( 'akismet/akismet.php');
But now i am doing activate the plugin from subfolder like this way
run_activate_plugin( 'akismet/newfolder/akismet.php');
Any suggestions?
Topic function-exists functions plugin-development plugins Wordpress
Category Web