Prevent Updates for Selected Plugins
Stops update checks and auto-updates for the plugins you list, for example a plugin you patched by hand or must keep on a tested version.
Opens WPIDE on
Code
$wpide_frozen_plugins = array( 'example-plugin/example-plugin.php' ); // Plugins to freeze.
add_filter( 'site_transient_update_plugins', function ( $value ) use ( $wpide_frozen_plugins ) {
if ( is_object( $value ) && isset( $value->response ) ) {
foreach ( $wpide_frozen_plugins as $plugin ) {
if ( isset( $value->response[ $plugin ] ) ) {
$value->no_update[ $plugin ] = $value->response[ $plugin ];
unset( $value->response[ $plugin ] );
}
}
}
return $value;
} );
add_filter( 'auto_update_plugin', function ( $update, $item ) use ( $wpide_frozen_plugins ) {
return isset( $item->plugin ) && in_array( $item->plugin, $wpide_frozen_plugins, true ) ? false : $update;
}, 10, 2 );
Notes
List plugin paths as folder/main-file.php (see the Plugins screen). Remember to update them manually when you are ready.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.