Changeset 2527 for trunk/wp-includes/functions.php
- Timestamp:
- 04/12/2005 09:12:28 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r2526 r2527 186 186 return 0; 187 187 188 // First, check to see if there is a 'p=N' to match against:189 preg_match('#[?&] p=(\d+)#', $uri, $values);190 $p = intval($values[ 1]);188 // First, check to see if there is a 'p=N' or 'page_id=N' to match against: 189 preg_match('#[?&](p|page_id)=(\d+)#', $uri, $values); 190 $p = intval($values[2]); 191 191 if ($p) return $p; 192 192 … … 236 236 // If using %post_id%, we're done: 237 237 if (intval($post_id)) return intval($post_id); 238 238 239 239 // Otherwise, build a WHERE clause, making the values safe along the way: 240 240 if ($year) $where .= " AND YEAR(post_date) = '" . intval($year) . "'"; … … 251 251 } 252 252 253 // if all we got was a postname, it's probably a page, so we'll want to check for a possible subpage 254 if ($postname && !$year && !$monthnum && !$day && !$hour && !$minute && !$second) { 255 $postname = rtrim(strstr($uri, $postname), '/'); 256 $uri_array = explode('/', $postname); 257 $postname = $uri_array[count($uri_array) - 1]; 258 $where = " AND post_name = '" . $wpdb->escape($postname) . "' "; 259 } 260 253 261 // Run the query to get the post ID: 254 262 $id = intval($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE 1 = 1 " . $where));
Note: See TracChangeset
for help on using the changeset viewer.