[wp-trac] [WordPress Trac] #51058: attachment_url_to_postid does not retrieve post ID of really large images
WordPress Trac
noreply at wordpress.org
Wed Aug 19 02:12:58 UTC 2020
#51058: attachment_url_to_postid does not retrieve post ID of really large images
-----------------------------+-----------------------------
Reporter: littler.chicken | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
Since WordPress now sets the `_wp_attached_file` meta value for very large
images to use the scaled image:
{{{
amazing-road-in-pure-nature-picjumbo-com.jpg
}}}
becomes
{{{
amazing-road-in-pure-nature-picjumbo-com-scaled.jpg
}}}
any function which uses `attachment_url_to_postid` on a large image URL
will not properly retrieve the image's post ID.
Use case: I use this function after removing intermediate image size
strings to get the post ID of the uploaded image. I'm currently getting
around this issue by inserting `-scaled` into the image URL and running
the function again if a post ID is not returned, but I would prefer if WP
could account for this, please.
Alternatively, if the WordPress function could manage the intermediate
size conversion on its own, that would also resolve the issue by removing
the need to remove it in the first place.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51058>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list