Start your cross-border journey
Contact us now

Website development customer service

Customer Service

Usually in the maintenance of WordPress, sometimes because of some errors or compatibility issues, we can not immediately upgrade the theme or plug-ins to the latest version, you need to keep the old version, but this time there will be a problem is that every time you click on the background will see a very conspicuous little red dot, affecting the background experience!
In this article we'll talk about how to hide WordPress theme or plugin update alerts without upgrading it.
If you wish to quickly hide all update alerts, including updates to WordPress themes, WordPress plugins, WordPress core, etc., you can add the following code to functions.php to indicate the removal of all update alerts
function remove_core_updates(){
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}
add_filter('pre_site_transient_update_core','remove_core_updates'); //WordPress core
add_filter('pre_site_transient_update_plugins','remove_core_updates'); //WordPress plugins
add_filter('pre_site_transient_update_themes','remove_core_updates'); //WordPress themes
It can also be controlled by the bottom three pieces of code, blocking certain categories of prompts, such as themes or plug-ins, simply by commenting out the corresponding lines of code
Hiding all updates is very easy to use, but it can interfere with getting future updates and is not recommended for long term use.
If you wish to block updates for a particular plugin on a long-term basis, you can add the following code to functions.php to block update prompts for only a single plugin
function remove_update_notifications( $value ) {
if ( isset( $value ) && is_object( $value ) ) {
unset( $value->response[ 'elementor/elementor.php' ] ); //replace with disabled plugin file
}
return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');
To use this code, you need to replace the elementor in this article with your own plugin, usually in the format of the main php file inside the plugin folder, you can go to the WordPress plugin directory /wp-content/plugins to check out
If you need to hide updates for a certain theme, you can use the following code
function remove_theme_update_notification( $value ) {
if ( isset( $value ) && is_object( $value ) ) {
unset( $value->response['astra'] ); // replace with your own theme name
}
return $value;
}
add_filter( 'site_transient_update_themes', 'remove_theme_update_notification' );
Similarly, you need to replace the theme name with your own, you can go to the WordPress theme directory /wp-content/themes to find under the name of the theme are relatively simple, usually the original theme name, such as ocanwp, astra, generatepress, etc.