From 3715a7061379a6aaf77d8924f917cb56e69be64f Mon Sep 17 00:00:00 2001 From: ocean90 Date: Wed, 29 Jun 2016 14:06:01 +0000 Subject: [PATCH] Posts: In `wp_ajax_inline_save()`, do not apply level for non-hierarchical post types. Props Offereins. Fixes #35010. git-svn-id: https://develop.svn.wordpress.org/trunk@37913 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 1864d878ac..a99912002e 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -1689,13 +1689,15 @@ function wp_ajax_inline_save() { $mode = $_POST['post_view'] === 'excerpt' ? 'excerpt' : 'list'; $level = 0; - $request_post = array( get_post( $_POST['post_ID'] ) ); - $parent = $request_post[0]->post_parent; + if ( is_post_type_hierarchical( $wp_list_table->screen->post_type ) ) { + $request_post = array( get_post( $_POST['post_ID'] ) ); + $parent = $request_post[0]->post_parent; - while ( $parent > 0 ) { - $parent_post = get_post( $parent ); - $parent = $parent_post->post_parent; - $level++; + while ( $parent > 0 ) { + $parent_post = get_post( $parent ); + $parent = $parent_post->post_parent; + $level++; + } } $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );