Last active
October 19, 2016 00:16
-
-
Save ctalkington/ff1d03758c12922a570d1b5a8753ced0 to your computer and use it in GitHub Desktop.
Block WordPress Plugin Updates - best placed in wp-content/mu-plugins/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Lock Plugin Updates | |
Description: Allow blocking plugins from being updated. | |
Version: 1.0.0 | |
Author: Example | |
Author URI: https://www.example.com/ | |
@author John Doe | |
*/ | |
add_filter( 'site_transient_update_plugins', 'prefix_lock_plugin_updates' ); | |
function prefix_lock_plugin_updates( $value ) { | |
if ( ! is_object( $value ) || ! isset( $value->response ) ) { | |
return $value; | |
} | |
// format (relative to plugins dir): plugin/main-plugin-file.php | |
$defaults = array(); | |
$locked_plugins = apply_filters( 'prefix_locked_plugins', $defaults ); | |
foreach( $locked_plugins as $plugin_basename ) { | |
unset( $value->response[ $plugin_basename ] ); | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment