[wp-trac] [WordPress Trac] #42138: Pass post ID into assign_terms checks

WordPress Trac noreply at wordpress.org
Sat Oct 7 21:07:36 UTC 2017


#42138: Pass post ID into assign_terms checks
-----------------------------+-----------------------------
 Reporter:  johnjamesjacoby  |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Taxonomy         |    Version:  3.0
 Severity:  normal           |   Keywords:  2nd-opinion
  Focuses:                   |
-----------------------------+-----------------------------
 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 ID
 * `current_user_can()` supports multiple `$args`, so an
 `assign_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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42138>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list