WordPress后台定制在企业网站开发中必不可少,在《移除WordPress文章/页面编辑窗口多余的meta模块》中已经说了什么是Meta模块(Meta Boxes),以及如何移除。今天倡萌分享下 WordPress自定义文章编辑页面的分类和标签Meta模块标题 的方法。
将下面的代码添加到主题的 functions.php 文件中:
add_action( 'add_meta_boxes', 'change_cat_meta_box', 0 );
function change_cat_meta_box() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['post']['side']['core']['categorydiv'] );
add_meta_box('categorydiv',
__('自定义分类模块标题'),
'post_categories_meta_box',
'post',
'side',
'low');
}
add_action( 'add_meta_boxes', 'change_tag_meta_box', 0 );
function change_tag_meta_box() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['post']['side']['core']['tagsdiv-post_tag'] );
add_meta_box('tagsdiv-post_tag',
__('自定义标签模块标题'),
'post_tags_meta_box',
'post',
'side',
'low');
} |
add_action( 'add_meta_boxes', 'change_cat_meta_box', 0 );
function change_cat_meta_box() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['post']['side']['core']['categorydiv'] );
add_meta_box('categorydiv',
__('自定义分类模块标题'),
'post_categories_meta_box',
'post',
'side',
'low');
}
add_action( 'add_meta_boxes', 'change_tag_meta_box', 0 );
function change_tag_meta_box() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['post']['side']['core']['tagsdiv-post_tag'] );
add_meta_box('tagsdiv-post_tag',
__('自定义标签模块标题'),
'post_tags_meta_box',
'post',
'side',
'low');
}
最终的结果如下图所示:

参考资料:http://wpmu.org/how-to-change-the-titles-of-your-wordpress-category-and-tag-meta-boxes/
来源:
https://www.wpdaxue.com/custom-title-of-category-and-tag-meta-boxes.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_32467.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57