Reputation: 2290
How can I use the below code in my wp-config
to disable multiple plugins?
For example, this code will stop plugin.php from updating but how can I disable multiple in an array
so that plugin.php, plugin1.php and plugin2.php are also disabled.
/* Function which remove Plugin Update Notices */
function disable_plugin_updates( $value ) {
unset( $value->response['plugin/plugin.php'] );
return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
Upvotes: 0
Views: 1977
Reputation: 11
Above answer is giving me warning, it should be like this.
/** Disable update check **/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin/plugin.php'] ) ) {
unset( $value->response['plugin/plugin.php'] );
}
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
Upvotes: 1
Reputation: 1131
/* Function which remove Plugin Update Notices */
function disable_plugin_updates( $values ) {
foreach($values as $value) {
unset( $value->response['plugin/plugin.php'] );
}
return;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
Upvotes: 1