昨天 @矢左00 询问如何去除 仪表盘>概况 的WordPress版本信息“您正在使用WordPress xxxx”

只需要将下面的代码添加到主题的 functions.php 即可:
/**
* 去掉<a href="https://www.wpdaxue.com/tag/%e4%bb%aa%e8%a1%a8%e7%9b%98" title="查看与【仪表盘】相关的文章" target="_blank" rel="noopener">仪表盘</a>“概况”下的WordPress版本信息
* https://www.wpdaxue.com/remove-dash-wordpress-version.html
*/
add_filter('gettext', 'remove_admin_stuff', 20, 3);
function remove_admin_stuff( $translated_text, $untranslated_text, $domain ) {
$custom_field_text = 'You are using <span class="b">WordPress %s</span>.';
if (!current_user_can( 'update_core') && is_admin() && $untranslated_text === $custom_field_text) {
return '';
}
return $translated_text;
} |
/**
* 去掉<a href="https://www.wpdaxue.com/tag/%e4%bb%aa%e8%a1%a8%e7%9b%98" title="查看与【仪表盘】相关的文章" target="_blank" rel="noopener">仪表盘</a>“概况”下的WordPress版本信息
* https://www.wpdaxue.com/remove-dash-wordpress-version.html
*/
add_filter('gettext', 'remove_admin_stuff', 20, 3);
function remove_admin_stuff( $translated_text, $untranslated_text, $domain ) {
$custom_field_text = 'You are using <span class="b">WordPress %s</span>.';
if (!current_user_can( 'update_core') && is_admin() && $untranslated_text === $custom_field_text) {
return '';
}
return $translated_text;
}
所有非管理员 administrator 角色的用户都无法看到版本信息,如果你希望连管理员角色都看不到,请删除第 8 行如下代码:
!current_user_can( 'update_core') && |
!current_user_can( 'update_core') &&
来源:
https://www.wpdaxue.com/remove-dash-wordpress-version.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32424.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57