mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 02:34:38 +00:00
added cache_pages to avoid making 1+X queries everytime wp_list_pages is called, where X is the number of pages
git-svn-id: https://develop.svn.wordpress.org/trunk@2354 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -941,10 +941,14 @@ function remove_action($tag, $function_to_remove, $priority = 10) {
|
||||
remove_filter($tag, $function_to_remove, $priority);
|
||||
}
|
||||
|
||||
function get_page_uri($page) {
|
||||
global $wpdb;
|
||||
$page = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$page'");
|
||||
function get_page_uri($page_id) {
|
||||
global $wpdb, $cache_pages;
|
||||
|
||||
if (!isset($cache_pages[$page_id])) {
|
||||
$cache_pages[$page_id] = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$page_id'");
|
||||
}
|
||||
|
||||
$page = $cache_pages[$page_id];
|
||||
$uri = urldecode($page->post_name);
|
||||
|
||||
// A page cannot be it's own parent.
|
||||
|
||||
Reference in New Issue
Block a user