As discussed at WordPress admin screen very slow / timing out when editing or adding a new page/custom post

I am having a similar issue on a WP site containing 7,784 pages. Edit screens are slow loading due to the rendering of all 7k pages in the source code for the Page Attributes dropdown menu. Besides editing core, there must be a better way to deal with this. Seems like a flaw to render all pages on the edit screen.

Feedback from others with high volume/traffic WP sites much appreciated!

  • where should I add these lines of code?
    – Daniel Wom
    Commented Jan 20, 2021 at 11:07
  • @DanielWom do not post comments as solutions, I also couldn't tell which answer you were responding to. I've edited your comment to remove the foul language and sarcasm ( this would be a good time to review the code of conduct wordpress.stackexchange.com/conduct )
    – Tom J Nowell
    Commented Jan 20, 2021 at 11:38

6 Answers 6


Removing support for page attributes will prevent that box from appearing...

function remove_page_attribute_support() {
add_action( 'init', 'remove_page_attribute_support' );

... but I don't know if you need attributes support or not. If you don't that is the fix.

If you do, you will need to remove the box as per @KrzysiekDrozdz's answer, but to be able to use those attributes you will have to rebuild that box, the original is here, in such a way that it works for you.


Just use remove_meta_box function:

if (is_admin()) :
function my_remove_meta_boxes() {
    remove_meta_box('pageparentdiv', 'page', 'side');
add_action( 'admin_menu', 'my_remove_meta_boxes' );

If you need to set hierarchy of these pages (set post_parent for pages), you can still do it. Just add your custom meta box, and place there a select box with list of pages.

You have to be sure, that your query (to select these pages) is more efficient thatn original though. You can list pages without hierarchy and select only title and page_id (original query will retrieve all page data from DB, and it can be a lot of data, if there are many pages), or something like that.


Another option is to filter the dropdown arguments before a call is made to wp_dropdown_pages. This function has a hook, but it happens after the query was made.

There are two places where it can be filtered: in Quick Edit mode and the Page meta box. But none is available for Options Reading or Theme Customizer.

enter image description here

The following are the default arguments and an example of filter to restrict pages by author (depth, child_of and exlcude seems good candidates too).

$defaults = array(
    'depth' => 0, 
    'show_date' => '',
    'date_format' => get_option('date_format'),
    'child_of' => 0, 
    'exclude' => '',
    'title_li' => __('Pages'), 
    'echo' => 1,
    'authors' => '', 
    'sort_column' => 'menu_order, post_title',
    'link_before' => '', 
    'link_after' => '', 
    'walker' => '',

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['authors'] = 'author_name';
    return $args;

You can easily disable page attribute dropdown using below code.

add_action( 'admin_init', 'tryvary_remove_feature_meta_box' );
function tryvary_remove_feature_meta_box() {
    remove_post_type_support( 'page', 'page-attributes' );

Just try to remove page attribute feature using admin_init hook. If it's doesn't work for you then try below code.

add_action( 'admin_head', 'misha_remove_meta_box', 1 );
function misha_remove_meta_box(){
    remove_meta_box( 'pageparentdiv', 'page', 'side' );

Try to remove meta box code using admin_head hook.

You will get more information about remove meta box and feature from this article.


Short Answer

$post_type_slug = 'page';
add_filter( "theme_{$post_type_slug}_templates", '__return_empty_array' );

Long Answer

Wordpress already does this for the post type "wp_navigation"

see: https://github.com/WordPress/WordPress/blob/master/wp-includes/default-filters.php#L629

add_filter( 'theme_wp_navigation_templates', '__return_empty_array' );

The line that applies the filter is as follows:

see: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-theme.php#L1427

$post_templates = (array) apply_filters( "theme_{$post_type}_templates", $post_templates, $this, $post, $post_type );

This filter allow you to modify the templates that can be used for this post type; or in your case; return an empty array; preventing the Post Attributes dropdown from rendering


I finally found a solution. Not the best one, but it's working. remove_meta_box and similar functions only works after the meta_box is added. Otherwise there is nothing to remove. So unfortunally that didn't work out for me. What was really working is a simple # to comment a line out of meta-boxes.php

if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) {
    #add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );

So you prevent the meta-box of getting loaded with all includes and thats it. Pages loading fast now. =)

  • You did that edit in the core? Commented Jan 21, 2021 at 15:14
  • wp-admin/includes/meta-boxes.php so after wordpress-update it could need to add again the "#" (if the update will overwrite the file). it's at line 1502
    – Daniel Wom
    Commented Jan 21, 2021 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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