Make WordPress Core


Ignore:
Timestamp:
12/16/2016 06:20:40 AM (8 years ago)
Author:
dd32
Message:

Media: Move a variable definition outside of conditionals to ensure it's always available.
This fixes cases where the URL to a PDF preview may be incorrectly calculated when no thumbnails were generated for the PDF (and avoids a PHP Notice at the same time).

Fixes #39250.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r39396 r39612  
    30643064
    30653065    $attachment_url = wp_get_attachment_url( $attachment->ID );
     3066    $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
    30663067
    30673068    $response = array(
     
    31713172                );
    31723173            } elseif ( isset( $meta['sizes'][ $size ] ) ) {
    3173                 if ( ! isset( $base_url ) )
    3174                     $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
    3175 
    31763174                // Nothing from the filter, so consult image metadata if we have it.
    31773175                $size_meta = $meta['sizes'][ $size ];
Note: See TracChangeset for help on using the changeset viewer.