WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am remote activating plugins using update_option('active_plugins,'some_plugins'); It works fine except one thing: if some plugins have to create some tables using register_activation_hook(__FILE__,'activate'); it won't create them.

When I'm activating plugins normally in wp-admin/plugins.php it works fine. Any ideas how to remote execute this activation hook or maybe there is different way to better plugin activation?

share|improve this question

Use activate_plugin() instead:

activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false )

You need just the first parameter, the same value as in the option.

This function will call the necessary actions:

if ( ! $silent ) {
    do_action( 'activate_plugin', $plugin, $network_wide );
    do_action( 'activate_' . $plugin, $network_wide );

Note: depending on where you call activate_plugin function you might need to add this:

 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
share|improve this answer
Hi toscho. I'm using xml-rpc calls to work on wordpress. activate_plugin() method isn't accessible by it. Calling do_action('activate_plugin','plugin/plugin.php',false) gives nothing. Only way I see for now is direct create tables in database. Or maybe You have another ideas? – bigwolk Jun 5 '13 at 6:54
@bigwolk Have you tried to extend XML RPC to get access to the function? – toscho Jun 5 '13 at 6:58
I'm using extended api plugin to access almost all methods in wordpress. – bigwolk Jun 5 '13 at 7:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.