wordpress plugin update
2Hats . 5 minutes
December 7, 2018

How to manage plugin updates without uploading in wordpress.org?

When developing a WordPress plugin or theme, there could be updates in future. When a plugin has updates, the developer can add new updates as new versions in plugins and themes. Normally, the WordPress plugin needs to be uploaded to WordPress.org plugins library and manage updates with git. But if it is a paid/pro plugin, it’s not possible with WordPress.org, because WordPress.org is only for managing free plugins. In this situation, developers can manage the WordPress plugins and theme updates with their own servers with Plugin Update Checker.
This is a custom update manager for WordPress plugins or themes useful if the owners don’t want to upload in public WordPress repositories. But it will help the users to get updates if available at the same time of developer update.

The Custom Update Checker has two main Sections

WP Update Server
This package considers the website as a repository. WP update server is part of the website that manages or sells the plugins.

Plugin Update Checker
This package will check the new updates of plugins and themes. Plugin update checker will be the part of a developed plugin. It adds automatic update notifications and one-click upgrades to plugins, private themes, and so on.

Implementation
Please follow below steps to implement the update server in custom plugin or theme.

Setting-up the server system
Download Wp update server from https://github.com/YahnisElsts/wp-update-server
Extract and upload to the uploads folder of the server WordPress site.
Eg: https://2hatslogic-wp.buildsite.in/wp-content/uploads/wp-update-server/

Update In Plugins
Download the latest release of plugin update checker from https://github.com/YahnisElsts/plugin-update-checker and copy the plugin-update-checker folder and paste into the commercial plugin or theme.

Move to the plugin-update-checker/examples folder and open the plugin.json for plugins and theme.json for a set in theme. Set the plugin or theme name, version, description in the JSON file

Add the following code in the plugin main file or functions.php file from themes

Eg,

From the example, ‘hatslogic-woo-variation’ is the plugin or theme slug

New Update Release

Once the update is done, edit the JSON file and zip the plugin or theme folder and copy this to the packages folder located in server-site/wp-content/uploads/wp-update-server/packages. Need to replace the current zip file once we add another version of the same plugin. And also the plugin zip file should be with the slug name. From the above example, it should be like ‘hatslogic-woo-variation.txt’

GitHub Integration

The plugin-update-checker can use with Github without a server system.

Follow the steps for GitHub integration,

  • Download plugin-update-checker and extract to commercial plugin or theme folder.
  • Add the following code in the theme functions.php or plugin core file
For plugins add a readme.txt file with the standard rules.

GitHub Releases :
Create a new release with the help of release “features” of GitHub. If need to use release includes, call the enableReleaseIncludes() method after creating the update checker instance:
$UpdateChecker->getVcsApi()->enableReleaseIncludes()
Tags: Tags are the versions of the new release like V1.2, V3.0
Stable Branch: Point the update checker to a completed branch in GitHub
$updateChecker->setBranch(‘branch-name’);

The plugin will check the version header in the main plugin file or style.css and display a notification if it’s greater than the already installed version.
The plugin update checker will pull update details from the following parts of a release/tag/branch:

  1. Version
    The version of the updated plugin or theme.
  2. Changelog
    Changes and newly added features in the new version.
  3. Required WordPress version
    Set the required WordPress version for the run the plugin or theme.
  4. Tested WordPress versions
    Set the plugin that tested with different versions of WordPress
  5. Last Update
    Fetch the last updated timestamp
  6. Number of Downloads
    Fetch the total number of downloads of a particular plugin or theme
  7. Ratings
    Fetch the rating details of the plugin or theme
  8. Screenshots
    Screenshots that’s a need to show in ‘screenshot’ tab of plugin details
  9. Banners
    The main banner that will display in the plugin details popup.

BitBucket Integration
If need plugin update checker with BitBucket integration, it similar to the GitHub integration,

  • Download plugin-update-checker and extract to commercial plugin or theme folder.
  • Add the following code in the theme functions.php or plugin core file
  •  Add the readme.txt file, it’s an optional step

So using the custom update checker anyone can easily implement plugin or theme updates without the use of WordPress.org or git knowledge.

And, it is easier than the WordPress repository uploads. The custom update checker is easy to test as well because this only needs to make 2 version changes in the JSON and plugin file and zip it to the server site folder wp-update-server and then make a refresh in the old version of the plugin installed in the site’s plugins page. It will show the new update notice there.

blog
Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.
Aneesh ceo
Aneesh Sreedharan
Founder & CEO, 2Hats Logic Solutions
Subscribe to our Newsletter
Aneesh ceo

    Stay In The Loop!

    Subscribe to our newsletter and learn about the latest digital trends.