Advanced Automatic Updates
Selective auto-updating of plugins (2 posts)

  1. Wombat
    Posted 2 years ago #

    Was wondering if this plugin will ever have a feature to selectively update plugins? Almost any site I build has about 95% unmodified plugins and some modded ones which cannot be updated automatically without breaking the machine.


  2. wiseowl9000
    Posted 2 years ago #

    1. Copy the code below into a file called plugin_filter.php
    2. Change the $pluginsNotToUpdate adding the plugins you want not to update, by using the plugin folder name and plugin filename
    3. Upload the file to your wp-plugins directory
     * @package Plugin_Filter
     * @version 2.0
    Plugin Name: Plugin Filter
    Plugin URI: http://www.brideonline.com.au/
    Description: Removes certain plugins from being updated.
    Author: Ben Wise
    Version: 2.0
    Author URI: https://github.com/WiseOwl9000
     * @param $update bool Ignore this it just is set to whether the plugin should be updated
     * @param $plugin string Indicates which plugin will be upgraded. Contains the directory name of the plugin followed by / followed by the filename containing the "Plugin Name:" parameters.
    function filter_plugins_bol($update, $plugin)
    	// debugging
    		$econ = ob_get_contents();
    	$pluginsNotToUpdate[] = "plugin-folder-name/plugin-file-name.php";
    	// add more plugins to exclude by repeating the line above with new plugin folder / plugin file
    	// Allow all plugins except the ones listed above to be updated
    	if (!in_array(trim($plugin),$pluginsNotToUpdate))
    //		error_log("plugin is not in list allowing");
    		return true; // return true to allow update to go ahead
    //	error_log("plugin is in list trying to abort");
    	return false;
    // Now set that function up to execute when the admin_notices action is called
    // Important priority should be higher to ensure our plugin gets the final say on whether the plugin can be updated or not.
    // Priority 1 didn't work
    add_filter( 'auto_update_plugin', 'filter_plugins_bol' ,20  /* priority  */,2 /* argument count passed to filter function  */);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Automatic Updates
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic