WordPress.org

Make WordPress Core

Ticket #30346: 30346.patch

File 30346.patch, 495 bytes (added by bradyvercher, 4 years ago)

Replace ltrim() with str_replace()

  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 1ab9a61..8f18a1f 100644
    function attachment_url_to_postid( $url ) { 
    32653265        global $wpdb;
    32663266
    32673267        $dir = wp_upload_dir();
    3268         $path = ltrim( $url, $dir['baseurl'] . '/' );
     3268        $path = str_replace( $dir['baseurl'] . '/', '', $url );
    32693269
    32703270        $sql = $wpdb->prepare(
    32713271                "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",