如何在我的wp-config
中使用以下代码来禁用多个插件?
例如,此代码将阻止plugin.php更新,但如何在array
中禁用多个,以便同时禁用plugin.php,plugin1.php和plugin2.php。
/* 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' );
答案 0 :(得分:1)
/* 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' );
答案 1 :(得分:1)
以上回答给我警告,应该是这样。
/** 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' );