wordpress - WordPress 用户角色
问题描述
我们可以在 WordPress.org 中添加更多“用户角色”吗?就像我们已经有 User->change role to->student or subscriber or author or customer 等,换句话说,我想根据他们的研究领域添加subscriber1、subscriber2、subscriber3。提前致谢。
解决方案
是的,您可以在 wordpress 中添加自定义用户角色。在您的主题函数文件中添加此代码
add_role('subscriber1', __(
'Moderator'),
array(
'read' => true, // Allows a user to read
'create_posts' => true, // Allows user to create new posts
'edit_posts' => true, // Allows user to edit their own posts
'edit_others_posts' => true, // Allows user to edit others posts too
'publish_posts' => true, // Allows the user to publish posts
'manage_categories' => true, // Allows user to manage post categories
)
);
推荐阅读
- python - Pandas 通过 Tuple 重命名 MultiIndex 的单行
- vb.net - 根据另一表中的条件过滤一个数据表
- sql - SQL:根据另一列将一列汇总为多列
- python - 如何解决“ModuleNotFoundError: No module named 'beautifulsoup4'”?
- python - 将voigt函数拟合到吸收曲线python
- javascript - Vue Tree 展平数组或递归组件
- bash - 如何完成具有多个参数/选项的 bash 函数?
- java - Java中接受两种不同类型作为参数的方法
- python-3.8 - 如何让我的语音助手启动应用程序?
- reactjs - 如何立即更新浏览器中的脚本文件。当我更新服务器中的脚本时