Hello Everyone,
If you want to hide the update links from wordpress admin dashboard then this post will helpful for you. We can hide update links from wordpress admin without using any plugins. Here I am going to describe the way to hide the update links using wordpress hooks. We are going to hide update links using wordpress hooks.
Let's start to hide wordpress update links using hooks of the wordpress
- First of all your require browse your current theme directory
- Then find the function.php file and open it in your editor
- add given below code into your theme function.php file to hide update alert message from admin dashboard
if ( ! function_exists( 'wpexperts_no_update_nag' ) ) :
function wpexperts_no_update_nag() {
remove_action( 'admin_notices', 'update_nag', 3 ); // remove update notice menu
}
endif;
add_action( 'admin_init', 'wpexperts_no_update_nag' );
Watch Video to Know How It Work
[youtube https://www.youtube.com/embed/MCvog8x4N2U]
-
add given below code into your theme function.php file to hide update menu link under dashboard and redirect update link to admin dashboard so on one can access the update url.
if ( ! function_exists( 'wpexperts_no_update_nag' ) ) :
function wpexperts_no_update_nag() {
remove_submenu_page( 'index.php', 'update-core.php' );
// Redirect to Dashboard if update page is accessed
global $pagenow;
$page = array(
'update-core.php',
'update.php',
'update.php?action=upgrade-plugin'
);
if ( in_array( $pagenow, $page, true ) ) {
wp_redirect( admin_url( 'index.php' ), 301 );
// wp_die( 'Updates are disabled.' ); // An error message can be displayed instead
exit;
}
}
endif;
add_action( 'admin_init', 'wpexperts_no_update_nag' );
- add given below code into your theme function.php file to hide all plugins update links, theme update links and "At a Glace" dashboard widget update link
if ( ! function_exists( 'wpexperts_remove_update_link_by_css' ) ) :
function wpexperts_remove_update_link_by_css()
{
echo '<style>.update-plugins,.plugin-update-tr,.subsubsub .upgrade,.theme .update-message,#dashboard_right_now #wp-version-message .button,#footer-upgrade{display:none !important;}</style>';
}
endif;
add_action( 'admin_footer', 'wpexperts_remove_update_link_by_css' );
A Complete code to hide all update links from admin dashboard at time, you can add given below code into your theme function.php file
if ( ! function_exists( 'wpexperts_no_update_nag' ) ) :
function wpexperts_no_update_nag() {
remove_action( 'admin_notices', 'update_nag', 3 ); // remove update notice menu
remove_submenu_page( 'index.php', 'update-core.php' );
// Redirect to Dashboard if update page is accessed
global $pagenow;
$page = array(
'update-core.php',
'update.php',
'update.php?action=upgrade-plugin'
);
if ( in_array( $pagenow, $page, true ) ) {
wp_redirect( admin_url( 'index.php' ), 301 );
// wp_die( 'Updates are disabled.' ); // An error message can be displayed instead
exit;
}
}
endif;
add_action( 'admin_init', 'wpexperts_no_update_nag' );
//hide links by css
function wpexperts_remove_update_link_by_css()
{
echo '<style>.update-plugins,.plugin-update-tr,.subsubsub .upgrade,.theme .update-message,#dashboard_right_now #wp-version-message .button,#footer-upgrade{display:none !important;}</style>';
}
add_action( 'admin_footer', 'wpexperts_remove_update_link_by_css' );