I’ve recently been experiencing problems involving a couple of pages on a (fairly large, content-heavy) WordPress site loading pretty slowly.
I narrowed down the cause to the wp_list_pages() and get_pages() functions which are called in a few places around the site. The problem is the SQL query these functions run which uses SELECT * FROM wp_posts which really affects performance especially when it’s retrieving all of every post’s content and all I want to display is a title and permalink
I was able to modify these functions to include a second optional parameter where the columns to be selected in the query can be specified (defaulting to *) but this is no good seeing as upgrading WordPress in the future will cause my changes to be reverted.
I was wondering what others have done in my situation. I’ve read about using filters and hooks to override functions but it’s a 167-line function that I need to edit two lines of - duplicating the entire function for this purpose seems pretty hacky.
My other thought was to set up an SVN repository where I could merge any changes from a fresh WP install into my modified code, but again this seems like overkill for my needs.
Any suggestions or pointers would be much appreciated