# Discourse WordPress 设置需要角色具备什么 wp\_capability？

**URL:** https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084
**Category:** WordPress
**Created:** [2020年二月20日 03:31 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084 "2020-02-20T03:31:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![RickU](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ricku/32/126290_2.png) [@RickU](https://meta.discourse.org/u/RickU)
#### Post date: [2020年二月20日 03:31 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/1 "2020-02-20T03:31:26Z")

</div>

大家好，

希望大家一切都好。  
我有一位开发人员没有管理员权限，需要访问以下页面：

- [Login | HSTS Redirection Community](https://site.com/wp-admin/admin.php?page=wp_discourse_options)

我需要知道完成此操作所需的 WordPress 权限（capability）是什么。  
我们已经授予了添加、编辑和安装插件的权限！

以下是显示问题的截图。

- [用户 WP 权限 discourse 2 |690x316](https://meta.discourse.org/uploads/short-url/mIk9KVyxsnXgFYE7DnCAnK8YLWw.jpeg)

非常感谢大家的帮助。

祝好！

#Support #Development #Contribute > Bug

 ![用户 WP 权限 discourse 2](https://global.discourse-cdn.com/meta/original/3X/9/f/9f32853c4edce9ddd806d49bfd21db1ec15d1488.jpeg)

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [2020年二月20日 13:14 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/2 "2020-02-20T13:14:41Z")

</div>

查看 GitHub，似乎使用的能力是 `manage_options`。

> <https://github.com/discourse/wp-discourse/blob/main/admin/admin-menu.php#L51>

---

<div class="post-metadata">

### Author: ![tariqkotwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tariqkotwal/32/135822_2.png) [@tariqkotwal](https://meta.discourse.org/u/tariqkotwal)
#### Post date: [2020年二月23日 09:57 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/3 "2020-02-23T09:57:39Z")

</div>

你好 @RickU，

有两种方法可以让你的开发者访问此页面：

方法一：

1. 安装 [User Role Editor 插件](https://wordpress.org/plugins/user-role-editor/)，为你的开发者创建一个自定义角色，并分配 manage\_options 权限。但这样也会让他能够访问设置等管理菜单。为避免这种情况，请再安装 [Adminimize 插件](https://wordpress.org/plugins/adminimize/)，并为该特定角色移除相应的管理菜单。
2. 使用你刚创建的新角色创建一个用户，并将登录凭证分享给你的开发者。

方法二：  
在你的主题或子主题（如果已启用子主题）中添加自定义代码，以设置 Discourse 管理菜单的自定义权限。通过代码创建一个自定义角色，并将新权限分配给该角色，然后创建使用该角色的用户，并将凭证分享给开发者。但需要注意的是，此方法下开发者只能查看页面，无法编辑、更新或保存任何更改，因为缺少 manage\_options 权限（该权限是保存 WordPress 选项所必需的）。如果你需要，我可以将代码上传到 GitHub 并在此分享链接。

请尝试以上任一方法，并告知我结果。🙂

---

<div class="post-metadata">

### Author: ![RickU](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ricku/32/126290_2.png) [@RickU](https://meta.discourse.org/u/RickU)
#### Post date: [2020年三月11日 06:47 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/4 "2020-03-11T06:47:02Z")

</div>

> [@tariqkotwal](#):
>
> 第 2 步：使用您创建的新角色创建一个用户，并将凭据分享给您的开发人员。
> 
> 另一种方法是：在您的主题或子主题（如果已激活子主题）中添加自定义代码，允许您为 Discourse 管理菜单访问设置自定义权限。通过代码创建一个自定义角色，将新权限分配给该角色，然后创建一个使用该自定义角色的用户，并将凭据分享给您的开发人员。但使用此方法时，您的开发人员只能查看页面，无法进行编辑。

我将仔细研究这个解决方案。看起来很简单。最近我一直在对我们网站进行大量更新，日程安排非常紧张。我会更新最终结果或所采取的路径。

非常感谢！😃

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2025年三月26日 17:35 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/5 "2025-03-26T17:35:26Z")

</div>

挖出这个帖子

在最新版本中，是否有办法为特定用户角色授予对 [WP Discourse](https://github.com/discourse/wp-discourse) 面板的访问权限？

听起来给他们完全的 `manage_options` 选项然后隐藏所有元素有点过头了。我们试图让我们的 wp 实例保持轻量级: (

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2025年三月26日 18:36 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/6 "2025-03-26T18:36:16Z")

</div>

访问情况与上述讨论保持一致。

你是否有你喜欢的、基于角色访问其管理面板的插件的示例，比如你建议的那种轻量级方案？我有兴趣改进这类功能，并希望了解存在的问题/期望的功能。

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2025年三月27日 11:01 UTC](https://meta.discourse.org/t/what-is-the-wp-capability-a-role-needs-to-access-the-discourse-wordpress-setting/142084/7 "2025-03-27T11:01:32Z")

</div>

在我们的用例中，我们正在使用 Learndash LMS，并使用 [WP Discourse](https://github.com/discourse/wp-discourse) 将他们的自定义帖子类型课程和主题发布到我们的论坛中。它有自己的讲师角色。虽然讲师可以编辑内容，但他们无法访问 [WP Discourse](https://github.com/discourse/wp-discourse) 面板。
