I’m new to the site but appreciate any help you can give.
I have a WordPress set-up which (rightly or wrongly) has hundreds of pages and thousands of another custom post type which is also based on a page (ie hierarchical).
When attempting to add a new page or custom post type (or edit an existing one) in the admin, the edit page screen loads extremely slowly if at all.
Usually timing out around the Attributes Box mark (sometimes it will load the entire page, sometimes not, but basically it’s either extremely unusable or not usable at all).
My assumption is that because there is so many items to be loaded on the hierarchy menu (within the Attributes Box) it’s causing the time out.
I understand that perhaps using so many pages in this way is perhaps not optimal for WP, but this is the situation the site is in now and I cannot easily change it (and unfortunately the ability to put a page within a certain hierarchy is needed so I can’t just hide the Attributes box from the admin).
In the long run maybe the site needs to be rebuilt to use only posts however is there anything I can do for now to either help WordPress load the edit page fully and/or speed it up.
Any htaccess/php.ini hacks (I’ve tried a couple, like increasing memory size/execution time but didn’t seem to help) or anything else you think I can try (I am open to nearly any idea), something in MYSQL to cache it maybe (I’m not an expert on this unfortunately)
Really appreciate any help you can give
Thanks, Nick
PS It’s WordPress 3.2.1
PPS I also tried editing the permalink structure so it doesn’t include %post-name but that didn’t help
PPPS I also tried duplicating the site and upgrading to WordPress 3.3 latest beta but still the same
PPPPS The site is on a Rackspace Sites Cloud Server
Also… I tried disabling the Attributes box and just trying to use the Quick Edit function on the Pages listing part of the admin to control hierarchy but this is not responsive presumably because it is ‘timing out’ because of the same issue, so unfortunately my temporary workaround idea doesn’t really do it either, cheers.
This may not help any, but it can’t hurt to try it… Log into your server admin area, invoke the client interface for your database administration (e.g. phpMyAdmin), delete all the posts where their ‘type’ is marked as a revision, then compact the table.
If you have thousands of pages, you might also have millions of revisions slowing up your access.
The problem lies elsewhere a little bit. WordPress builds page hierarchy to fill post_parent select box. When there are many pages, this function can be a little bit slow (sometimes it is very slow).
So what can you do about it?
You can disable WordPress default page attributes meta box, using code below:
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 though (list pages without hierarchy and select only title and page_id, or something like that).PS. Look at WPs source code to see why it can be slow, when there are many pages… It uses
get_pages
withhierarchical
argument set to true. It usesget_page_children
then and it isn’t very efficient function…I had the same issue 5000+ pages, which made it take quite some time.
The issue was Page Attributes which used wp_dropdown_pages -> loading all pages!
Since I still needed the possibility to use templates, only removing Page Attributes wasn’t going to solve it.
And since I don’t like to hack directly in core files, my solution was to remove then re-enable my own version of Page Attributes (taken from core files).
In WP 3.5.1, to resolve this big problem (if you don’t need often the attributes box) the best way is just not displaying the attributes box. To do this, comment lines 132 to 134 in wp-admin/edit-form-advanced.php.
No attributes box displayed, no slow edit page.