[wp-trac] [WordPress Trac] #55609: Drop-down list of pages (to select the parent page in post editor) incomplete or empty when the number of pages> 100

WordPress Trac noreply at wordpress.org
Sat Apr 23 01:38:18 UTC 2022


#55609: Drop-down list of pages (to select the parent page in post editor)
incomplete or empty when the number of pages> 100
--------------------------+-----------------------------
 Reporter:  axdr          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  5.9.3
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 The problem is in the algorithm for creating a list of pages.

 **Location**: post editor - wp/wp-admin/post.php?post=1234&action=edit

 **Conditions**:
 1. number of posts (with "''type=page and status=publish''")  > 100
 2. page with parent=0 and some number of children does not meet "''ORDER
 BY wp_posts.menu_order ASC LIMIT 0, 100''" \\ Even if all of it Children
 have been returned by query, none of them will be in the list.

 **Cause**:
 {{{
        wp-includes/js/dist/editor.js
            6004: function PageAttributesParent()
              6076:
                 if (!fieldValue) {
                       tree = buildTermsTree(tree);
                 }
              ----------------------
              5904: function buildTermsTree(flatTerms)
                5927: return fillWithChildren(termsByParent['0'] || []);
 }}}

 **Solution**:
        It is necessary to build a page query differently.
        For example, choose pages that have parent=0
        Then pages that have parent among first group of pages.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55609>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list