WordPress.org

Make WordPress Core

Changeset 10254


Ignore:
Timestamp:
12/26/2008 02:59:04 AM (13 years ago)
Author:
azaozz
Message:

Fix uploaded media relative links when site has been moved, props DD32, fixes #8705 for trunk

File:
1 edited

Legend:

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

    r10226 r10254  
    742742    $custom = get_post_custom($post_id);
    743743
    744     return $custom[$key];
     744    return isset($custom[$key]) ? $custom[$key] : null;
    745745}
    746746
     
    25902590            if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
    25912591                $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
     2592            elseif ( false !== strpos($file, 'wp-content/uploads') )
     2593                $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
     2594            else
     2595                $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.
    25922596        }
    25932597    }
Note: See TracChangeset for help on using the changeset viewer.