Last active
February 11, 2021 18:54
-
-
Save afragen/2ed3f5a3d8c3ecca74955fa30fcb82e7 to your computer and use it in GitHub Desktop.
Prevent updating for specific WordPress 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 | |
// Prevent updating of specific dot org plugins. | |
add_filter( | |
'site_transient_update_plugins', | |
function( $transient ) { | |
$plugin_arr = [ 'test-plugin2/test-plugin2.php', 'akismet/akismet.php' ]; | |
foreach ( $plugin_arr as $plugin_file ) { | |
if ( isset( $transient->response[ $plugin_file ]->id ) | |
&& false !== strpos( $transient->response[ $plugin_file ]->id, 'w.org/plugins' ) | |
) { | |
unset( $transient->response[ $plugin_file ] ); | |
} | |
} | |
return $transient; | |
}, | |
99, | |
1 | |
); |
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 | |
// Prevent updating of specific plugins. | |
add_filter( | |
'site_transient_update_plugins', | |
function( $transient ) { | |
$plugin_arr = [ 'test-plugin2/test-plugin2.php', 'akismet/akismet.php' ]; | |
foreach ( $plugin_arr as $plugin_file ) { | |
if ( isset( $transient->response[ $plugin_file ] ) ) { | |
unset( $transient->response[ $plugin_file ] ); | |
} | |
} | |
return $transient; | |
}, | |
99, | |
1 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment