Support » Plugin: Nested Pages » Losing nesting when editing a page

  • jhertel

    (@jesper-hertel)


    When editing and updating a page that is nested under another page, the edited page consistently loses its nesting and subsequently appears in the root, in the position corresponding to its menu_order value.

    It might influence this issue that both pages are private and hidden from menus.

Viewing 1 replies (of 1 total)
  • level13studios

    (@level13studios)

    I was having the same trouble as my ‘Parents’ selector was only showing top level pages so as soon as I was on a child of a child page it reset the parent on save as it was not in the list. After much googling, I used this function this in my theme’s functions.php file:

    add_filter( 'page_attributes_dropdown_pages_args', 'so_3538267_enable_parent_depth' );
    add_filter( 'quick_edit_dropdown_pages_args', 'so_3538267_enable_parent_depth' );
    
    function so_3538267_enable_parent_depth( $args )
    {
        $args['depth'] = 2;
        return $args;
    }

    which I adapted from here: https://stackoverflow.com/questions/3538267/wordpress-admin-show-draft-pages-in-page-attributes-parent-page-dropdown

    and this is the original function:

    add_filter( 'page_attributes_dropdown_pages_args', 'so_3538267_enable_drafts_parents' );
    add_filter( 'quick_edit_dropdown_pages_args', 'so_3538267_enable_drafts_parents' );
    
    function so_3538267_enable_drafts_parents( $args )
    {
        $args['post_status'] = 'draft,publish,pending';
        return $args;
    }

    If you do a var_dump($args); in the function and refresh or go to an edit page, you’ll see the options you can set.

    Hope that helps

Viewing 1 replies (of 1 total)
  • The topic ‘Losing nesting when editing a page’ is closed to new replies.