WordPress.org

Ready to get started?Download WordPress

Forums

Editing Sort Column for Pages on View All Tab in Admin Menu Screen (2 posts)

  1. S. Wyatt Young
    Member
    Posted 1 year ago #

    Greetings!

    I'm in the process of designing a WordPress theme for a client, who happens to have a lot of pages (107, to be exact). When I go to the Admin Appearance > Menus screen to edit their menus, I noticed that the View All tab of the Pages post type widget doesn't sort by menu order, and thus doesn't tier the pages according to the parent-child relationship. Is there a way to easily change that with a filter, preferably without editing the WordPress code itself?

    Thanks so much!

    Regards,
    S. Wyatt Young

  2. S. Wyatt Young
    Member
    Posted 1 year ago #

    So, I've found a filter that may work for this, but I'm not sure how to apply a function to do what I'm looking for. (Filters still kind of confuse me.) The following code is found at line 750 of /wp-admin/includes/nav-menu.php:

    $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type );
    $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );

    This, it seems logical that hooking a function into the "nav_menu_items_page" filter could potentially do the trick. Only, I don't know what to do with $posts in order to get what I'm looking for. And unless $args is modified too, will it matter, given that the walk_nav_menu_tree function will use whatever orderby argument is supplied in $args?

    Thanks again for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic