Support » Plugins » Hacks » Programmatically update WordPress

  • Hi WordPress Community,

    I’m trying to figure out how I can programmatically update the version of wordpress through a wordpress plugin. I’ve been searching around ( the wordpress source and the codex ) all day but I couldn’t seem to find anything that would work. Because of the nature of the plugin, I want to find a function that does not echo out a bunch of html forms and such if it is possible. ( I can always filter it out later but less is more convenient ) Hopefully later I could also find something to update the plugins as well.


Viewing 2 replies - 1 through 2 (of 2 total)
  • 7 month old post, so probably a bit late but hope this helps anybody else thats looking for the same answer. To get a list of plugins that need updating use:
    get_plugin_updates() (in /wp-admin/includes/update.php)

    To update the plugins use:
    wp_update_plugin() (also in /wp-admin/includes/update.php)

    The wp_update_plugin() param is the index file of the plugin being updated and not the results of calling get_plugin_updates(). So for example to update the well known Akismet plugin you would call:
    wp_update_plugin( 'akismet/akismet.php' );

    hope this helps 😉

    I was actually just thinking about something like this the other day. From the sounds of it, you would need to execute a CRON every so often to check for updates from WordPress and then execute the update if the version found is newer. I don’t know the specifics involved in all of that, but I believe the logic is sound.

    @coombesy – I think they want to know how to update the WordPress core on a set schedule, although your method could probably be used to make plugins do that as well, but you’d still need a self-executing script and the only thing I can think of is CRON.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Programmatically update WordPress’ is closed to new replies.