Make WordPress Core

Ticket #31044: trac.31044.diff

File trac.31044.diff, 367 bytes (added by ashfame, 11 years ago)

Adding my version of patch so that after the query, we judge the condition and return appropriate value in one go.

  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index c7d092d..8be4fa6 100644
    function attachment_url_to_postid( $url ) { 
    33013301                $path
    33023302        );
    33033303        $post_id = $wpdb->get_var( $sql );
    3304         if ( ! empty( $post_id ) ) {
    3305                 return (int) $post_id;
    3306         }
     3304
     3305        return $post_id ? (int) $post_id : 0;
    33073306}
    33083307
    33093308/**