[wp-trac] [WordPress Trac] #32585: Programatically using wp_insert_post with post_author=0 does not work when user is logged in
WordPress Trac
noreply at wordpress.org
Mon Jun 8 12:07:19 UTC 2015
#32585: Programatically using wp_insert_post with post_author=0 does not work when
user is logged in
-------------------------------+-----------------------------
Reporter: ericdaams | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 4.2.2
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
Passing a `post_author` of 0 to `wp_insert_post` does not work if the user
is logged in.
Reproducible with:
{{{
add_action( 'init', function() {
$args = array(
'post_title' => 'test',
'post_author' => 0
);
$post_id = wp_insert_post( $args );
echo get_post_field( 'post_author', $post_id ); // post_author is
1
});
}}}
`post_author` returns 1, despite `post_author` being set explicitly to 0.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32585>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list