Hi i have a Wordpress installation with over 35000 pages which are sorted into trees like so ... enter image description here

There is an ongoing issue with page edit loading very slowly or failing to load at all. Through long trial and error and research i found it to be caused by the loading of parent select (10K pages crashes it)

on previous similar projects i disabled the parent select through the following function but it still seems to run a huge query causing it to run out of memory

add_filter( 'quick_edit_dropdown_pages_args', 'limit_parents_wpse_106164' );
add_filter( 'page_attributes_dropdown_pages_args', 'limit_parents_wpse_106164' );

function limit_parents_wpse_106164( $args ) {
  $args['child_of'] = 4009;
  //Id 4009 post dosn't exist
  return $args;

is there a way to dequeue the Query from happening and removing parent select from page attribute section all together?

Thank you in advance.

  • Try the plugin Nested Pages, which replaces the native WP screen for pages (& optionally other post types) - it might be built to better handle them Nov 11 '16 at 16:13
  • I tested it earlier and not a possible solution as their ajax fails while loading the 35k+ pages. the ordering is not a problem as im using CMS Tree Page View (wordpress.org/plugins/cms-tree-page-view) View for ordering. what i really need is to prevent that query from executing Nov 11 '16 at 16:20
  • 1
    Does putting $args['post_type'] = 'does_not_exist'; instead in the filter help at all?
    – bonger
    Nov 11 '16 at 17:55
  • @bonger that seem to have resolved the issue could you post as an answer and explain a bit and i will upvote and accept it. thank you Nov 12 '16 at 0:17
  • Excellent, I'll do that, ta...
    – bonger
    Nov 12 '16 at 3:53

Per comments a way around it is to set the post_type to something that isn't a hierarchical type in the filter, as the wp_dropdown_pages() function used to populate the select calls get_pages() which just returns without doing anything if the post_type isn't hierarchical. So using a non-existent post_type works:

function limit_parents_wpse_106164( $args ) {
    $args['post_type'] = 'does_not_exist';
    return $args;

Note that the original filter idea comes from @brasofilo here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.