[wp-trac] [WordPress Trac] #30346: Attachments not being found with attachment_url_to_postid()

WordPress Trac noreply at wordpress.org
Fri Nov 14 23:57:09 UTC 2014


#30346: Attachments not being found with attachment_url_to_postid()
--------------------------+------------------------------
 Reporter:  bradyvercher  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.0
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by bradyvercher):

 The easiest solution would replace `ltrim()` with `str_replace()`, but I'm
 not sure if there are limitations with that as well:

 `$path = str_replace( $dir['baseurl'] . '/', '', $url );`

 That also doesn't seem to account for all the
 [https://github.com/WordPress/WordPress/blob/3e94d3a931953e3f3e3fe949fdb4c0f8e248b990
 /wp-includes/post.php#L4925-L4939 scenarios covered by]
 `wp_get_attachment_url()`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30346#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list