更改新帖子中类别标题的名称

时间:2018-01-26 作者:Nick Wild

在后端管理页面中,我想在用户创建新帖子时更改类别选择框标题的名称。

与其将其命名为“类别”,不如将其命名为“部门”

enter image description here

同样,我想将“标签”改为“技术”

谢谢

1 个回复
最合适的回答,由SO网友:Elex 整理而成

您可以处理wp_taxonomies 对象期间init 行动然后可以更改categoriesposts tags.

function wpse292282_rename_default_taxonomies() {
    global $wp_taxonomies;

    // Update datas for Category
    $labels = &$wp_taxonomies[\'category\']->labels;
    $labels->name = \'Sector\';
    $labels->singular_name = \'Sector\';
    $labels->add_new = \'Add Sector\';
    $labels->add_new_item = \'Add Sector\';
    $labels->edit_item = \'Edit Sector\';
    $labels->new_item = \'Sector\';
    $labels->view_item = \'View Sector\';
    $labels->search_items = \'Search Sectors\';
    $labels->not_found = \'No Sectors found\';
    $labels->not_found_in_trash = \'No Sectors found in Trash\';
    $labels->all_items = \'All Sectors\';
    $labels->menu_name = \'Sector\';
    $labels->name_admin_bar = \'Sector\';

       // Update datas for Tags
    $labels = &$wp_taxonomies[\'post_tag\']->labels;
    $labels->name = \'Technologies\';
    $labels->singular_name = \'Technology\';
    $labels->add_new = \'Add Technology\';
    $labels->add_new_item = \'Add Technology\';
    $labels->edit_item = \'Edit Technology\';
    $labels->new_item = \'Technology\';
    $labels->view_item = \'View Technology\';
    $labels->search_items = \'Search Technologies\';
    $labels->not_found = \'No Technologies found\';
    $labels->not_found_in_trash = \'No Technologies found in Trash\';
    $labels->all_items = \'All Technologies\';
    $labels->menu_name = \'Technologies\';
    $labels->name_admin_bar = \'Technologies\';

}
add_action( \'init\', \'wpse292282_rename_default_taxonomies\' );

结束