WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r35725 r36151  
    42914291    foreach ( $page->ancestors as $parent ) {
    42924292        $parent = get_post( $parent );
    4293         if ( 'publish' === $parent->post_status ) {
     4293        if ( $parent ) {
    42944294            $uri = $parent->post_name . '/' . $uri;
    42954295        }
     
    48704870                $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file);
    48714871            } elseif ( false !== strpos($file, 'wp-content/uploads') ) {
    4872                 $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
     4872                // Get the directory name relative to the basedir (back compat for pre-2.7 uploads)
     4873                $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . basename( $file );
    48734874            } else {
    48744875                // It's a newly-uploaded file, therefore $file is relative to the basedir.
Note: See TracChangeset for help on using the changeset viewer.