WordPress.org

Make WordPress Core

Ticket #35010: inline-save.1.diff

File inline-save.1.diff, 949 bytes (added by Offereins, 5 years ago)

Do not apply level for non-hierarchical post types

  • trunk/wp-admin/includes/ajax-actions.php

    diff --git a/trunk/wp-admin/includes/ajax-actions.php b/trunk/wp-admin/includes/ajax-actions.php
    index 29a11fc..5c73ec8 100644
    a b function wp_ajax_inline_save() { 
    16621662        $mode = $_POST['post_view'] === 'excerpt' ? 'excerpt' : 'list';
    16631663
    16641664        $level = 0;
    1665         $request_post = array( get_post( $_POST['post_ID'] ) );
    1666         $parent = $request_post[0]->post_parent;
    16671665
    1668         while ( $parent > 0 ) {
    1669                 $parent_post = get_post( $parent );
    1670                 $parent = $parent_post->post_parent;
    1671                 $level++;
     1666        if ( $wp_list_table->hierarchical_display ) {
     1667                $request_post = array( get_post( $_POST['post_ID'] ) );
     1668                $parent = $request_post[0]->post_parent;
     1669
     1670                while ( $parent > 0 ) {
     1671                        $parent_post = get_post( $parent );
     1672                        $parent = $parent_post->post_parent;
     1673                        $level++;
     1674                }
    16721675        }
    16731676
    16741677        $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );