WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#3373 closed enhancement (invalid)

Better get_page_uri

Reported by: ryanscheuermann Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.5
Component: Optimization Keywords: get_page_uri has-patch needs-test
Focuses: Cc:

Description

Upon testing the queries on some of my sites, I found that there were a LOT more queries for pages that were deeper/farther down in the page hierarchy. I am using get_page_link to get the link for pages on the navigation. This function calls get_page_uri which in turn calls get_page over and over until it builds the tree. When you call get_page, you run a SELECT * FROM wp_posts query. List all your pages, and you've now SELECT *'d every single page.

I've attached a patch that builds the hierarchy from 1 query instead of multiple.

Attachments (2)

get_page_uri.patch (1.3 KB) - added by ryanscheuermann 9 years ago.
fixed bug: include attachment uris
get_page_uri.2.0.5 (1.4 KB) - added by ryanscheuermann 9 years ago.
faster get_page_uri for WP 2.0.5

Download all attachments as: .zip

Change History (8)

#1 @ryanscheuermann
9 years ago

  • Version changed from 2.1 to 2.0.5

This ticket could also be modified and applied to 2.0.6. I've attached that patch also.

@ryanscheuermann
9 years ago

fixed bug: include attachment uris

@ryanscheuermann
9 years ago

faster get_page_uri for WP 2.0.5

#2 @matt
9 years ago

  • Milestone changed from 2.1 to 2.2

#3 @foolswisdom
9 years ago

  • Milestone changed from 2.2 to 2.4

#4 @hangy
8 years ago

  • Keywords has-patch needs-test added
  • Type changed from defect to enhancement

#5 @ffemtcj
8 years ago

  • Milestone changed from 2.5 to 2.6

#6 @DD32
7 years ago

  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from new to closed

WordPress no longer selects every page on such a query, Closing as invalid.

Note: See TracTickets for help on using tickets.