[wp-trac] [WordPress Trac] #53181: attachment_url_to_postid not working in latest wordpress

WordPress Trac noreply at wordpress.org
Tue May 11 13:55:17 UTC 2021


#53181: attachment_url_to_postid not working in latest wordpress
--------------------------+-----------------------------
 Reporter:  hedgehog90    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.7.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Given the url of an existing attachment:
 "https://localhost/wp-content/uploads/2021/05/14893-tiny-toon-adventures-
 nes-front-cover.jpg"

 On wp-include/media.php line 4809 it does something strange:

 {{{#!php
 if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
   $path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
 }
 }}}

 It removes the baseurl, leaving a partial path that will never be found in
 the database.
 However if instead it replaced $dir['baseurl'] with $dir["basedir"], it
 would create a valid $path.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53181>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list