mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user