Make WordPress Core

Changeset 10253


Ignore:
Timestamp:
12/26/2008 02:57:35 AM (16 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7/wp-includes/post.php

    r10214 r10253  
    742742    $custom = get_post_custom($post_id);
    743743
    744     return $custom[$key];
     744    return isset($custom[$key]) ? $custom[$key] : null;
    745745}
    746746
     
    25412541            if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
    25422542                $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
     2543            elseif ( false !== strpos($file, 'wp-content/uploads') )
     2544                $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
     2545            else
     2546                $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.
    25432547        }
    25442548    }
Note: See TracChangeset for help on using the changeset viewer.