我使用以下代码来禁用插件更新通知,但仅当插件处于活动状态时才有效,因此如果我取消激活插件,则会开始显示更新通知。即使插件未激活,如何停止此通知?
add_filter('site_transient_update_plugins', 'dd_remove_update_nag');
function dd_remove_update_nag($value) {
unset($value->response[plugin_basename(__FILE__)]);
return $value;
}
答案 0 :(得分:1)
将以下代码放入您的子主题 funcation.php 文件中
// Remove certain plugins
function my_recommended_plugins( $plugins ) {
// Remove notice to install WooCommerce
unset( $plugins['woocommerce'] );
// Return plugins
return $plugins;
}
add_filter( 'wpex_recommended_plugins', 'my_recommended_plugins' );
// Remove all plugins
// THIS IS NOT RECOMMENDED IF YOU ARE USING SOME OF THE PLUGINS SINCE THE NOTICE IS IS ALSO USED TO LET YOU KNOW OF UPDATES
add_filter( 'wpex_recommended_plugins', '__return_empty_array' );
就这样
答案 1 :(得分:0)
例如,如果您不希望Wordpress显示akismet的更新通知,您可以这样做:
function filter_plugin_updates( $value ) {
unset( $value->response['akismet/akismet.php'] );
return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );