Hi There,
Some time we have some restrictions in wordpress admin panel or some time wordpress's instillation is not proper working and we are hurry to do some work.
So here is the best example you can use this example.
All you have to Add this code to your theme's function.php and there you have to mention plugin name and plugin's installation file.
<? php
function run_activate_plugin_noidex( $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_noidex( 'ultimate-noindex-nofollow-tool-ii/ultimate-noindex.php' );
?>
So in above function I am taking an example to NO-INDEX, NO-FOLLOW plugin, you can see above GREEN COLOR line .
Here this is plugin folder "ultimate-noindex-nofollow-tool-ii" and this is installation file "ultimate-noindex.php"
You can use any plugin you want just replace the plugin name and installation file.
That's all!!
Happy Programing :-)
Some time we have some restrictions in wordpress admin panel or some time wordpress's instillation is not proper working and we are hurry to do some work.
So here is the best example you can use this example.
All you have to Add this code to your theme's function.php and there you have to mention plugin name and plugin's installation file.
<? php
function run_activate_plugin_noidex( $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_noidex( 'ultimate-noindex-nofollow-tool-ii/ultimate-noindex.php' );
?>
So in above function I am taking an example to NO-INDEX, NO-FOLLOW plugin, you can see above GREEN COLOR line .
Here this is plugin folder "ultimate-noindex-nofollow-tool-ii" and this is installation file "ultimate-noindex.php"
You can use any plugin you want just replace the plugin name and installation file.
That's all!!
Happy Programing :-)
No comments:
Post a Comment