page_rows -function inefficient?
|Reported by:||janit||Owned by:|
|Component:||Optimization||Keywords:||pages cms performance page_rows reporter-feedback|
I ended up using WP as a CMS with quite a lot of pages. I ran into problems with the generation time of wp-admin/edit-pages.php. I digged a bit deeper and found out that the performance can be enhanced by modifying wp-admin/admin-functions.php. The page_rows -function the SQL query could be optimized from
if (!$pages) $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");
$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' AND post_parent = $parent ORDER BY menu_order");
This improved my generation time from ~8.0 seconds to ~0.4 seconds. I realize that WP is not exactly meant for this, but I think a change this small is worth to do.