Changes between Initial Version and Version 1 of Ticket #10457, comment 68
- Timestamp:
- 11/14/2017 05:25:55 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #10457, comment 68
initial v1 3 3 1) Someone adds a Text widget to the sidebar with a `[gallery]` shortcode in it, wanting to show the attachments from the current singular post. If this widget is shown on an index page, then it will get populated with whatever the last post was in the The Loop, and have unpredictable results. Even on a singular template it will have an unreliable result. 4 4 5 2) Someone also adds a widget that lists out posts from some category on the site. But they don't reset the `$post` after they do so, which is a very common issue. For example, this was just fixed in core even for the Recent Posts widget: #37312.The result is that `[gallery]` would never show the attachments for the current queried post anyway if it relied on `get_post()`. It would only ever show the attachments from the last post in that widget that listed out posts from the category.5 2) Someone also adds a widget that lists out posts from some category on the site. But they don't reset the `$post` after they do so, which is a very common issue. ~~For example, this was just fixed in core even for the Recent Posts widget: #37312.~~ (Correction: the Recent Posts widget isn't a problem here because it's regarding the global query and it does reset post data.) The result is that `[gallery]` would never show the attachments for the current queried post anyway if it relied on `get_post()`. It would only ever show the attachments from the last post in that widget that listed out posts from the category.