Skip to content

Commit d74aad6

Browse files
committed
Fix for getting parent post
1 parent a2c6c10 commit d74aad6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Posts/Post.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ public function content()
112112
*/
113113
public function parent()
114114
{
115-
return new Post(($this->getPost()->post_parent ?? 0));
115+
$parent_id = $this->getPost()->post_parent;
116+
117+
return ($parent_id ? new Post($parent_id) : null);
116118
}
117119
}

0 commit comments

Comments
 (0)