Make WordPress Core

Changeset 2611


Ignore:
Timestamp:
05/18/2005 02:27:43 AM (21 years ago)
Author:
ryan
Message:

More url_to_postid() fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2610 r2611  
    173173// examine a url (supposedly from this blog) and try to
    174174// determine the post ID it represents.
    175 function url_to_postid($url = '') {
     175function url_to_postid($url) {
    176176        global $wp_rewrite;
    177177
    … …  
    188188
    189189        $req_uri = $url;
    190         $home_path = parse_url(get_settings('home'));
    191         $home_path = $home_path['path'];
    192 
    193         $req_uri = str_replace(get_settings('home'), '', $req_uri);     
    194         $req_uri = str_replace($home_path, '', $req_uri);
     190
     191        if ( false !== strpos($req_uri, get_settings('home')) ) {
     192                $req_uri = str_replace(get_settings('home'), '', $req_uri);
     193        } else {
     194                $home_path = parse_url(get_settings('home'));
     195                $home_path = $home_path['path'];
     196                $req_uri = str_replace($home_path, '', $req_uri);
     197        }
     198
    195199        $req_uri = trim($req_uri, '/');
    196200        $request = $req_uri;
Note: See TracChangeset for help on using the changeset viewer.