Skip to content

Commit

Permalink
Merge pull request WP-API#391 from maxcutler/patch-2
Browse files Browse the repository at this point in the history
post 'parent' value should be null rather than zero if unset
  • Loading branch information
rmccue committed Aug 1, 2014
2 parents eedb81f + 19024e1 commit bfd047f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/class-wp-json-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,10 @@ protected function prepare_post( $post, $context = 'view' ) {
if ( empty( $post_fields['format'] ) ) {
$post_fields['format'] = 'standard';
}

if ( 0 === $post['post_parent'] ) {
$post_fields['parent'] = null;
}

if ( ( 'view' === $context || 'view-revision' == $context ) && 0 !== $post['post_parent'] ) {
// Avoid nesting too deeply
Expand Down

0 comments on commit bfd047f

Please sign in to comment.