Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35233 closed defect (bug) (duplicate)

wp_insert_post with tax_input in cron / admin-ajax.php as guest

Reported by: sebastianpisula's profile sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:


I have script to get auctions from other website and add in my WordPress. I use taxonomy for categories of auctions. I configured cron and test my script and I found problem - My script can't set taxonomies because user isn't logged in. My script:

$postarr = array(
                'post_title'  => esc_html( $data['title'] ),
                'post_type'   => 'auctions',
                'post_status' => 'publish',
                'tax_input'   => array(
                        'auctions-type'               => array( 10 ),

$auction_id = wp_insert_post( $postarr )

Why this don't work ? Because is if in wp-includes/post.php:3477:

if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) {

I think that this is bug

Attachments (1)

35233.patch (603 bytes) - added by sebastian.pisula 9 years ago.

Download all attachments as: .zip

Change History (2)

#1 @ocean90
9 years ago

  • Component changed from General to Posts, Post Types
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #19373.

Note: See TracTickets for help on using tickets.