Hide WordPress Version From Dashboard Footer
By Xps. 7 Comments
Hiding your WordPress installation version is a good idea. Knowing what version you’re running, a malicious person could take advantage of the vulnerabilities identified within that version and potentially corrupt, delete, or even control your WordPress installation and all your web host files. Why some theme developers decide to advertise the version within the <head>
element and WordPress itself displays the version to everyone with an account inside the Dashboard (wp-admin) area is unknown to me.
In this tech tip, I’ll be showing you how to hide the version from non-Admins in the Dashboard footer.
Open up the /wp-admin/admin-footer.php
with your favorite text editor (I prefer Notepad++). On line 25, locate:
<p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p>
Replace that with:
<?php if ( is_super_admin() )
echo '<p id="footer-upgrade" class="alignright">'. $upgrade .'</p>';
?>
You must use the is_super_admin()
function instead of the is_admin()
function. The former checks if the user is a network/super admin, while the latter checks if the user is viewing the Dashboard or administration panels (ie. any user who is logged in).
Core File! Since this tip is an adjustment to the WordPress core, you will need to adjust it after each update. Make a note of it with a link back here so you don’t forget.
Update: Functions hook
By XPS on July 16, 2012.
Although the above adjustment is rather small, it is an adjustment to the core system, so it will likely need to be applied after each WordPress automatic update. Fortunately, WordPress now uses “minimal updates,” which means only files that are modified in the newer version will be touched. Files that haven’t changed in the new version won’t any longer be replaced.
Even so, some people prefer to abstain from adjusting core files as much as possible. Thanks to functions.php
files, you don’t need to. Either at the bottom of your /wp-content/themes/{YOUR THEME}/functions.php
file or at the bottom of your “Functions Plugin” if you’re using one, add the following code:
/**
* Hide WP version on dashboard's footer unless your User can update WP
* Taken from https://www.computertechtips.net/85/hide-wordpress-version-from-dashboard-footer/
*/
if ( !function_exists('ctt_hideversionfooter') ) {
function ctt_hideversionfooter($upgrade) {
if ( !current_user_can('update_core')) {
echo '';
}
else {
return $upgrade;
}
}
add_filter('update_footer', 'ctt_hideversionfooter', 100);
}
The difference between the code at the top and this hook is how they decide to show it. The update_core
capability is one that a Super Admin has. So, they’re different in a specific sense, but they function just the same.
The number 100 at the end of the add_filter
line specifies the priority that this adjustment should apply. A priority of 100 is certainly low enough to allow higher priority adjustments of the update_footer
function to work.
Comments (7)
-
Very nice solution, thanks XPS!
-
Although this is a nice article but I have also created a very simple plugin to remove the version number as well as footer text from the admin dashboard.
You can checkout it here Remove Admin Footer and Version
Thanks,
-
Hi XPS,
No its not like that, I am very proud of using opensource specially WordPress but this plugin I just made for those people who seek some sort of client branding before handing over website to the client.
Thanks.
One year later… There is no hook for this?