Opened 8 years ago
Last modified 2 years ago
#41179 new enhancement
Adding get_the_content-filter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.8 |
Component: | Themes | Keywords: | needs-codex dev-feedback |
Focuses: | docs, template | Cc: |
Description
Hey there,
atm I cannot replace the content by a custom on, because of missing filter for get_the_content().
Attached a patch for this.
Attachments (1)
Change History (9)
This ticket was mentioned in Slack in #themereview by nikolam. View the logs.
7 years ago
#4
@
7 years ago
- Keywords has-patch removed
This patch does not match the ticket description. The patch adds parameters to the the_content
filter, which would break all kinds of themes, plugins, and core.
Why do you think get_the_content()
needs a filter? I thought the whole point of it was that it was returning the actual content, unfiltered. It is a reliable source of actual content.
#5
@
7 years ago
Why it would break all kinds of themes, plugins or core? It does not replace params. Also atm plugins, themes and core just uses add_filter( 'the_content', 'yourfunction', PRIORITY )
, no admin is using here the param $accepted_args, because not needed. If used, they have to use 1. So it's not breaking anything. The other params are optional.
get_the_content()-filter is needed for plugins to change content in themes. The params $more_link_text
& $strip_teaser can then be used by plugins e.g. to readd the $more_link_text after changing content.
#6
@
7 years ago
Ooops, my mistake of thinking the parameters backwardly. Sorry.
I still think get_the_content()
is better left unfiltered.
BTW the function get_the_content() and the_content() seems too much inconsistent compared with e.g. get_the_excerpt() and the_excerpt(). Also it looks too much complex (job could surely be done in an easier way). May it needs a complete refactoring.
Pro:
Contra:
PS: I hope for WP 5.0 you're planning some refactoring, e.g. media lib and code cleanup / consistency.