Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Commit

Permalink
Merge pull request #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 d77c2f5 + 7d6f6dd commit f50d190
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/class-wp-json-posts.php
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 f50d190

Please sign in to comment.