Avoid a PHP notice when trying to access the post_parent property of hierarchical post type nav menu items.

FIxes #34446


git-svn-id: https://develop.svn.wordpress.org/trunk@35876 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2015-12-12 01:05:27 +00:00
parent 4dfb95179a
commit 9c354378ff

View File

@ -215,7 +215,7 @@ class Walker {
$top_level_elements = array(); $top_level_elements = array();
$children_elements = array(); $children_elements = array();
foreach ( $elements as $e) { foreach ( $elements as $e) {
if ( 0 == $e->$parent_field ) if ( empty( $e->$parent_field ) )
$top_level_elements[] = $e; $top_level_elements[] = $e;
else else
$children_elements[ $e->$parent_field ][] = $e; $children_elements[ $e->$parent_field ][] = $e;