[wp-trac] [WordPress Trac] #39304: `get_post_galleries()` can return incorrect gallery items.
WordPress Trac
noreply at wordpress.org
Mon Feb 13 19:37:07 UTC 2017
#39304: `get_post_galleries()` can return incorrect gallery items.
--------------------------------------+------------------
Reporter: dd32 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.8
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------
Comment (by joemcgill):
I've split out a separate unit test for this case in
[attachment:39304-tests.diff]. The approach to force for the ID works ok,
but is definitely a hack. Seems like a bad idea that `gallery_shortcode()`
always tries to get the post ID from global state when one is not
explicitly passed as an attribute, but still maybe better to hack in an
explicit post ID rather than trying to override global state at that point
(which is another thing we could do).
As an aside, I can't think of a time where we would want
`gallery_shortcode()` to return unattached images whenever it's called in
a context without a global post object set.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39304#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list