How to simply set up a remote update of the WordPress plugin from your hosting?
This is not difficult .
1 Step – we will use Update Checker Library for this.
We have the Puc folder and plugin-update-checker.php. plugin-update-checker.php must be include into our WordPress plugin file.
/* Plugin Update */ require 'plugin-update-checker.php'; $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( '//yourlink/testwp/maxtestplugin.json', __FILE__, //Full path to the main plugin file or functions.php. 'maxtest-plugin' );
Finished test plugin file. Add reference to the json file, and the name of the plugin.
<?php /** * Plugin Name: Maxtest Plugin * Description: Custom Plugin Update from Remote Server * Plugin URI: maximumtheme.net * Version: 1.0.0 * Author: maxtestplugin * Author URI: //maximumtheme.net * Text Domain: maxtest_plugin */ /*Your code*/ /* Plugin Update */ require 'plugin-update-checker.php'; $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( '//yourlink/testwp/maxtestplugin.json', __FILE__, //Full path to the main plugin file or functions.php. 'maxtest-plugin' );
Json file upload to the hosting from which the plugin will download
json file for update wordpress plugin, have:
{ "name" : "maxtest-plugin", "version" : "1.0.1", "download_url" : "//yourlink/testwp/maxtest-plugin.zip", "sections" : { "description" : "Test Plugin:" } }
Update-checker – checks for updates every 1 hour.