[wp-trac] [WordPress Trac] #41744: wp_insert_post() function doesn`t set the taxonomies from AJAX call

WordPress Trac noreply at wordpress.org
Mon Aug 28 15:39:03 UTC 2017


#41744: wp_insert_post() function doesn`t set the taxonomies from AJAX call
-------------------------------+------------------------------
 Reporter:  WeddyWood          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.8.1
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by joyously):

 > `current_user_can()` does not work with AJAX

 That's a broad statement (AJAX is generic). If you use the REST API, you
 have to do authentication differently than if you use an ajax_action hook.
 The ajax_action hooks will only work from the WP site because of the
 authentication cookies. Those ajax_action hooks can (and do in core admin
 pages) use `current_user_can()`.

 Could you explain a test case?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41744#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list