替換 bbPress 預設角色使用者名稱的方法,比較實在的自定義,要新增到 模板函式 (functions.php) 檔案裡面。
// 替换 bbPress 默认角色用户名 add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' ); function ntwb_bbpress_custom_role_names() { return array( // Keymaster bbp_get_keymaster_role() => array( 'name' => ' 管理员', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) ), // Moderator bbp_get_moderator_role() => array( 'name' => ' 版主', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) ), // Participant bbp_get_participant_role() => array( 'name' => ' 社区成员', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) ), // Spectator bbp_get_spectator_role() => array( 'name' => ' 观众', 'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() ) ), // Blocked bbp_get_blocked_role() => array( 'name' => ' 禁闭用户', 'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() ) ) ); }
在官方社羣搜尋到的, https://bbpress.org/forums/topic/addchange-user-roles/
收錄於薇曉朵技術論壇,原帖地址:https://bbs.weixiaoduo.com/topic/17169