Opened 7 years ago
Closed 4 years ago
#42138 closed enhancement (duplicate)
Pass post ID into assign_terms checks
Reported by: | johnjamesjacoby | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
When checking if a user can assign_terms
it would be helpful to know which post ID it is that terms are potentially being assigned to.
This would allow plugins to conditionally prevent the assignment of terms to specific posts.
A few more thoughts about this idea:
- The singular form (
assign_term
) already exists, and accepts a term ID, to check if a specific term ID is assignable assign_terms
may not always be used in the context of a single post IDcurrent_user_can()
supports multiple$args
, so anassign_term_to_post
could, in theory, accept both the post ID and term ID at the same time, though nothing in core takes advantage of this yet. We should probably stick to independently checking each object, but I wanted to mention the idea to be thorough.
I'll post a first-pass patch at including the post ID imminently.
Attachments (1)
Change History (5)
#1
in reply to:
↑ description
;
follow-up:
↓ 2
@
7 years ago
- Keywords has-patch added
#2
in reply to:
↑ 1
@
7 years ago
Replying to johnbillion:
Post meta checks make use of this. AFAIK it's the only place in core that does. https://core.trac.wordpress.org/browser/trunk/src/wp-includes/capabilities.php?rev=41322&marks=307#L304
Oh yeah! Yay prior art!
Note: See
TracTickets for help on using
tickets.
Replying to johnjamesjacoby:
Post meta checks make use of this. AFAIK it's the only place in core that does. https://core.trac.wordpress.org/browser/trunk/src/wp-includes/capabilities.php?rev=41322&marks=307#L304