[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 20:11:50 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-dev- | Focuses:
note |
-------------------------------------------------+-------------------------
Comment (by Mista-Flo):
Replying to [comment:19 johnbillion]:
> 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.
Hi John, I have uploaded a new patch without the fallback to the global
post object.
I have also improved the doc and added more consistency to the filters.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37255#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list