Created
January 27, 2025 23:18
-
-
Save BruceMcKinnon/db2d13cb8de151f8a6c67a427dff8cf0 to your computer and use it in GitHub Desktop.
Disable updating of a Wordpress Plugin(s)
This file contains hidden or 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
// | |
// Disable updates to a plugin - solution found on https://wordpress.stackexchange.com/questions/397326/how-do-i-disable-an-update-for-a-specific-plugin | |
// | |
function AS_disable_plugin_updates( $value ) { | |
//create an array of plugins you want to exclude from updates ( string composed by folder/main_file.php) | |
$pluginsNotUpdatable = [ | |
'plugin1/plugin.php', | |
'plugin2/plugin2.php' | |
]; | |
if ( isset($value) && is_object($value) ) { | |
foreach ($pluginsNotUpdatable as $plugin) { | |
if ( isset( $value->response[$plugin] ) ) { | |
unset( $value->response[$plugin] ); | |
} | |
} | |
} | |
return $value; | |
} | |
add_filter( 'site_transient_update_plugins', 'AS_disable_plugin_updates' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment