Move code out of the conditional. props duck_, fixes #14415.

git-svn-id: https://develop.svn.wordpress.org/trunk@16104 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2010-10-30 18:21:23 +00:00
parent 0ab13047ef
commit 310a9b04d2
2 changed files with 9 additions and 9 deletions

View File

@@ -3097,6 +3097,7 @@ function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
*/
function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
global $wpdb;
$null = null;
$page_path = rawurlencode(urldecode($page_path));
$page_path = str_replace('%2F', '/', $page_path);
$page_path = str_replace('%20', ' ', $page_path);
@@ -3110,7 +3111,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
$pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type ));
if ( empty($pages) )
return null;
return $null;
foreach ( $pages as $page ) {
$path = '/' . $leaf_path;
@@ -3124,7 +3125,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
return get_page($page->ID, $output, $post_type);
}
return null;
return $null;
}
/**