[wp-trac] [WordPress Trac] #10275: Filter logic has been put into the template loader while it not belongs there.
WordPress Trac
noreply at wordpress.org
Tue Sep 10 15:05:18 UTC 2024
#10275: Filter logic has been put into the template loader while it not belongs
there.
-------------------------------------+-----------------------
Reporter: hakre | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 6.7
Component: Themes | Version: 2.8
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: template
-------------------------------------+-----------------------
Changes (by desrosj):
* keywords: dev-feedback has-patch => has-patch needs-testing
* milestone: => 6.7
Comment:
It's not exactly clear what problem this addresses. But I can't find a
scenario where `prepend_attachment()` is actually utilized in Core as a
filter anymore.
In the latest version of Core (currently 6.6), it's
[https://core.trac.wordpress.org/browser/branches/6.6/src/wp-includes
/default-filters.php#L197 added as a default filter] for `the_content`,
and [https://core.trac.wordpress.org/browser/branches/6.6/src/wp-includes
/template-loader.php#L85 only removed] when `is_attachment` is the
template file. But when the filter is called when displaying non-
attachment posts, the
[https://core.trac.wordpress.org/browser/branches/6.6/src/wp-includes
/post-template.php#L1719 function returns early].
A [https://wpdirectory.net/search/01J7E7AEJ2Q8BV296YQE6FRM5R brief check
of the plugin directory shows] that plugins are either calling
`prepend_attachment()` directly or adding it as a filter for their own
custom hooks. So I don't expect anything to break related to 3rd-party
usage.
I've opened a PR and removed the related code and default filter, and no
tests broke. I'm moving this to the `6.7` milestone for a second set of
eyes before committing.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/10275#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list