Change WordPress user roles and capabilities › Forums › Bug Reports › Unable to add/remove tags when editing a post
- This topic has 3 replies, 2 voices, and was last updated 3 years, 11 months ago by
Vladimir.
-
AuthorPosts
-
23/03/2021 at 19:45 #7435
awu
ParticipantHello,
I configured a user who has the Editor role and manage_categories permission enabled. This user is restricted to edit posts for category ID = 3 (following the instructions here: https://www.role-editor.com/allow-user-edit-selected-posts/).
What to do: “Allow”
with category/taxonomy ID: 3The user is able to see and edit posts that belong to category ID 3. When editing/creating a post, however, they are unable to add or remove tags. The API call to fetch tags returns an empty array:
/wp-json/wp/v2/tags?per_page=20&orderby=count&order=desc&_fields=id,name&search=test&_locale=user
=>[]
Removing the value 3 from “with category/taxonomy ID” fixes the tag issue but then the user is able to edit all posts.
Since this role has the
manage_categories
permission, the user is able to make edits to tags and categories by visiting:Posts -> Tags
Posts -> CategoriesIf the user visits Posts -> All Posts and immediately visits the Tags or Categories dashboard, there will be 0 results. Refreshing the page will show the list of all tags and/or categories.
WordPress 5.7
User Role Editor Pro 4.59.225/03/2021 at 12:47 #7438Vladimir
KeymasterHi,
It seems as expected behavior. Restriction by category ID is global for all taxonomies. So when you all to see at backend and edit only posts with category (taxonomy) ID=3, you automatically prohibit editing posts with any other taxonomy ID. Thus use can not add to the post new tags/taxonomies.
As about 0 items at the tags or categories page, it is a result of URE’s internal caching. But if you limit user to edit post only with the restricted list of existing taxonomies – you should not allow him to edit them. You have to delegate this function to another user according to my logic. So taxonomy editing pages should not be available to a user restricted such way.
25/03/2021 at 20:57 #7440awu
ParticipantHi Vladimir,
Thanks for the explanation. Are there any workarounds when using URE that will allow the user to tag and/or categorize the post?
Ideally:
User is restricted to create and edit posts that have category ID 3
User should be able to add/remove tags to these posts27/03/2021 at 11:13 #7443Vladimir
KeymasterHi,
Currently there is no such workaround. Restriction is applied to all existing taxonomies at once.
I will think how to exclude selected taxonomies from the restriction using custom filter and apply this to one of the future versions. -
AuthorPosts
- You must be logged in to reply to this topic.