Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

If I write a private plugin, is there any way to use the WordPress auto-update mechanism to update it?

I want to encapsulate the functionality, but it's specific to my own 5 or so blogs, so it's not a good candidate for the public plugins resource. But I love the easy-updating mechanism.

Is there a way to do this?

share|improve this question

6 Answers 6

up vote 21 down vote accepted

Looks like the applicable code is in wp-includes/update.php, wp_update_plugins():

$to_send = (object) compact('plugins', 'active');

$options = array(
    'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), 
    'body' => array( 'plugins' => serialize( $to_send ) ),
    'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
);  

$raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options);

It specifically checks api.wordpress.org. Technically speaking it would be possible to pass a key inside $to_send to delegate the check, but to my knowledge that is not a supported feature.

If you hook into set_site_transient_update_plugins you could add your own package details into this variable. It looks like those values will be trusted when you run the plugin updater. See wp-admin/update.php and wp-admin/includes/class-wp-upgrader.php. Given the code in these two functions, I think it would be possible to inject your own update server, you just need to look at how the package details are formatted and match that.

share|improve this answer

This plugin does it for you:

Automatic Updates For Private And Commercial Plugins

Since time immemorial, only plugins hosted in the official WordPress.org plugin directory have supported automatic updates. Now, I’ve written a PHP library that you can use to add automatic update capabilities to any plugin. Public, private and commercial plugins alike – all can now enjoy the benefits of automatic update notifications and one-click upgrades.

GitHub repository

share|improve this answer
2  
Oh. My. Days. This looks good :) –  TheDeadMedic Dec 12 '10 at 20:02
    
You may also be interested to manage the plugins on your side ... maybe with the package wp-update-server, written by the same author ;) github.com/YahnisElsts/wp-update-server By using this server, you can secure your plugins, as described here: w-shadow.com/blog/2013/03/19/… –  SimonSimCity Jul 9 at 7:32

I'm looking into the same thing. A couple of links that I've found that might be helpful:

The first is some info and pointers to the upgrades API. The second is a code snippet showing how to actually request info from the API.

share|improve this answer
1  
@Dougal - Nice links! –  MikeSchinkel Oct 21 '10 at 8:53

I believe this was discussed as a filterable option on the wp-hackers mailing list back in the day. It was never resolved, IIRC. I think the relevant discussion was in this thread:

http://lists.automattic.com/pipermail/wp-hackers/2009-February/024796.html

...but I could be wrong.

share|improve this answer
    
Easier to read thread: wordpress-hackers.1065353.n5.nabble.com/… –  brasofilo Sep 22 '13 at 3:58

you can use this commercial plugin: http://autohosted.com/ no limitation and have several other feature you might need:

  • No monthly charge
  • Unlimited use
  • Easy integration with Themes and Plugins
  • Authentication by domains, keys, & roles
share|improve this answer

There is no way you can do this natively. You'll just have to provide some other mechanism that updates your other plugins automatically.

Assuming you could update thos plugins, you would have to update each blog. I think it's better to build something that makes an automated deployment after you release a new version. For example, something like Capistrano.

share|improve this answer

Your Answer

 
discard

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.