• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

repo.somersetwebservices.co.uk

Just another WordPress site

  • Plugin update library
  • Test pages
    • SWS Accordion Plugin
    • SWS Meetings
    • SWS Councillors Plugin
    • SWS Road Closures
    • SWS Planning Applications
  • Post #26
  • My page title

Plugin update library

To update our custom plugins, I found a 3rd party update library we can use on github here: https://github.com/YahnisElsts/plugin-update-checker This is a custom update checker library for WordPress plugins and themes. It lets you add automatic update notifications and one-click upgrades to your commercial plugins, private themes, and so on. All you need to do is put your plugin/theme details in a JSON file, place the file on your server, and pass the URL to the library. The library periodically checks the URL to see if there’s a new version available and displays an update notification to the user if necessary. From the users’ perspective, it works just like with plugins and themes hosted on WordPress.org. The update checker uses the default upgrade UI that is familiar to most WordPress users. Read its full details on Github: https://github.com/YahnisElsts/plugin-update-checker How to add to a custom plugin To add the library to your custom plugin, download the latest release and add its folder to your plugin home directory. Next in your plugin index file, include code like the following: // Plugin update system // This will include the update system Plugin Update Checker by YahnisElsts // https://github.com/YahnisElsts/plugin-update-checker require_once 'plugin-update-checker/plugin-update-checker.php'; // Location of the external json file to check for updates, this should check for updates automatically every 12 hours $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( 'https://repo.somersetwebservices.co.uk/swsupdate/sws-notes-plugin.json', __FILE__, 'sws-notes' ); Require_once is adding the library to your plugin $myUpdateChecker initializes the library and this is where you need to add the location of your update json file ( More on this below ).

Primary Sidebar

copy