Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Post Author != logged in user Check in insert_post wrong... #44

merged 1 commit into from Dec 14, 2013


None yet
1 participant

rmccue commented Dec 9, 2013


In Line 790 of /lib/class-wp-json-posts.php (protected function insert_post), the userdata of a user != logged in user should be fetched and checked if it exists:

$author = get_userdata( $post['post_author'] );

As $post['post_author'] at this time is set to 0, there is always an error.
I think, this line should read

$author = get_userdata( $data['author'] );

as this is the correct User ID for the to post to be inserted.

Also, there should be a line

$post['post_author'] = $data['author'];

after the check (Line 534).

Kuchen und Kakao

@ghost ghost assigned rmccue Dec 9, 2013

rmccue added a commit that referenced this pull request Dec 14, 2013

Merge pull request #44 from WP-API/post-insert-author
Post Author != logged in user Check in insert_post wrong...

@rmccue rmccue merged commit f2edd27 into master Dec 14, 2013


rmccue commented Dec 14, 2013

Thanks for the bug report! 🎆

@rmccue rmccue deleted the post-insert-author branch Dec 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment