getButterfly Logo getButterfly code wrangling since 2005

And not only.

I have recently implemented update notifications for my ImagePress plugin.


The idea is simple:

Read a remote XML file, get the version number and compare it to the installed one.

Display a “new update available” tag inside WordPress.

Do this once a day and cache the result.

In order to achieve this, here’s what you need to do:

1. Get the required files from github.

2. Add wp-update-notifier.php to your plugin or theme folder.

3. Make the necessary changes according to the comments inside the file.

// replace "PLUGINNAME", "pluginname" and "Plugin Name" by your plugin name to prevent conflicts between plugins using this script
// replace "" by your domain URL
// replace "envatousername" by your Envato username

4. Call the file inside your plugin: <?php require 'wp-update-notifier.php'; ?>

5. Add the XML file to your server and edit it accordingly.

I suppose one could add licensing verification by using the same process, although the XML file should not be publicly readable, or it should be encoded.

This code was adapted from Pippin Williamson’s library and modified for inclusion in my plugin.

This module can be used both for WordPress plugins and WordPress themes, don’t forget to change CodeCanyon to ThemeForest if you want to use it for a theme.

As always, feedback or pull requests are welcome.

Image credit: ethanollie

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply

Love programming?

Learn about the most amazing things. Get smarter everyday!