Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#55609 closed defect (bug) (duplicate)

Drop-down list of pages (to select the parent page in post editor) incomplete or empty when the number of pages> 100

Reported by: axdr's profile axdr Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9.3
Component: Editor Keywords: needs-patch
Focuses: Cc:

Description

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.


Change History (2)

#1 follow-up: @SergeyBiryukov
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome back to WordPress Trac!

Thanks for the report, we're already tracking this issue in #52626.

#2 in reply to: ↑ 1 @axdr
2 years ago

Replying to SergeyBiryukov:

Hi there, welcome back to WordPress Trac!

Thanks for the report, we're already tracking this issue in #52626.

Do not forget to consider that boxing size for the output list is small to display too much records

Note: See TracTickets for help on using tickets.