[wp-trac] [WordPress Trac] #35233: wp_insert_post with tax_input in cron / admin-ajax.php as guest
WordPress Trac
noreply at wordpress.org
Sun Dec 27 17:39:57 UTC 2015
#35233: wp_insert_post with tax_input in cron / admin-ajax.php as guest
------------------------------+-----------------------------
Reporter: sebastian.pisula | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
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:
{{{#!php
<?php
$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:
{{{#!php
<?php
if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
}}}
I think that this is bug
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35233>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list