[wp-trac] [WordPress Trac] #37255: Update attachment functions to accept a post object in addition to ID
WordPress Trac
noreply at wordpress.org
Thu Oct 1 17:25:29 UTC 2020
#37255: Update attachment functions to accept a post object in addition to ID
-------------------------------------------------+-------------------------
Reporter: wido | Owner: joemcgill
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.6
Component: Media | Version: 4.6
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs- | Focuses:
refresh |
-------------------------------------------------+-------------------------
Changes (by johnbillion):
* keywords: has-patch needs-testing => has-patch needs-testing needs-
refresh
Comment:
Allowing these functions to accept either a post ID or a post object is a
good idea. This should be the case for ''any'' function that accepts a
post ID.
Making the ID parameter optional for these attachment related functions
may cause some unexpected behaviour though. There's a limited number of
places where calling `wp_get_attachment_url()` without an ID parameter
would work as expected, in fact the only one I think of off the top of my
head is when viewing an attachment at its permalink.
I'd like to see this patch land but without the fallback to the global
post object.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37255#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list