wearerequired/WP-Widget-Disable

Add settings for browser and PHP nag widgets

Closed this issue · 0 comments

Core has a wp_dashboard_browser_nag() and wp_dashboard_php_nag() widget. Both are registered depending on an API call, wp_check_browser_version() and wp_check_php_version(). Thus both are not collected by the current collector.

I'm proposing to add both widgets as hardcoded settings like we did with the Gutenberg callout. To disable the widgets, when set, we can use the site transient filter to prevent the API call which finally prevents registering the dashboard widgets.

// Browser nag
$key = md5( $_SERVER['HTTP_USER_AGENT'] );
add_filter( 'pre_site_transient_browser_' . $key, '__return_null' );

// PHP nag
$key = md5( phpversion() );
add_filter( 'pre_site_transient_php_check_' . $key, '__return_null' );