[wp-trac] [WordPress Trac] #41816: attachment_url_to_postid() should find post_id for URLs of intermediate size images

WordPress Trac noreply at wordpress.org
Thu Feb 7 21:45:13 UTC 2019


#41816: attachment_url_to_postid() should find post_id for URLs of intermediate
size images
-------------------------------------------------+-------------------------
 Reporter:  pbiron                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Media                                |     Version:  4.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback 2nd-opinion   |     Focuses:
  has-unit-tests                                 |
-------------------------------------------------+-------------------------

Comment (by pbiron):

 I've abandoned the approach in
 [[https://core.trac.wordpress.org/attachment/ticket/41816/41816.diff|41816.diff]]
 (the "hueristic" isn't reliable).

 Instead, a while ago I came up with an "exact" algorithm that I
 implemented as a function that can be hooked to
 [[https://developer.wordpress.org/reference/hooks/attachment_url_to_postid/|atthement_url_to_postid]]
 in [[https://gist.github.com/pbiron/d72a5d3b63e7077df767735464b2769c|a
 gist]].

 However, as mentioned in that gist, there are several cases where the
 `_wp_attachment_metadata` postmeta it relies on can be incorrect and until
 those are fixed I don't think it is worth pursuing converting that
 algorithm into a patch.

 Related: #44127, #42437, #44095

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


More information about the wp-trac mailing list