WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Action for after plugin update? (2 posts)

  1. Mike Stop Continues
    Member
    Posted 2 years ago #

    I want to apply a patch to a plugin automatically after each update.

    I'm looking for a filter/action that runs after a plugin update or, preferably, after a specific plugin is updated.

  2. Mike Stop Continues
    Member
    Posted 2 years ago #

    Here it is!

    add_filter('activate_advanced-akismet/akismet.php','c_patch_plugin');
    function c_patch_plugin() {
    	$fp = PATH_TO_FILE;
    	$file = @file_get_contents($fp);
    
    	if($file && !strstr($file,'/* EDIT */')) {
    		$file = str_replace(
    			'/* ORIGINAL */',
    			'/* EDIT */',
    			$file
    		);
    
    		$fp = fopen($fp, 'w');
    		fwrite($fp,$file);
    		fclose($fp);
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Topic