inconsistency in filters for the_content and the_excerpt
|Reported by:||opajaap||Owned by:|
|Component:||Posts, Post Types||Keywords:||needs-patch|
My plugin replaces a keytext by a div tag using a filter:
This filter appears also to be run in an excerpt, while my div is stripped in the excerpt.
When my div is stripped i want - instead of that div - to print a notification like - Here belongs my div -.
So, either i need a boolean variable or function that tells me that my filter is currently run by a call to the_excerpt(), OR the filter should not be run on the excerpt if it is not added to the excerpts filter list.
I tried a workaround by adding a new filter to the_excerpt and setting my own global to indicate i am in an excerpt, but unfortunately this filter is run after the the_content filter, despite fiddling with filter priorities. So, in a list (archive) the first excerpt is still in error.
The documentation says about filters:
applied to the post content retrieved from the database, prior to printing on the screen (also used in some other operations, such as trackbacks).
applied to the post excerpt (or post content, if there is no excerpt) retrieved from the database, prior to printing on the screen (also used in some other operations, such as trackbacks).
It appears that not only the_excerpt filters are run on the content if there is no excerpt, what is fine, but it works also the other way around: the the_content filters are run on the excerpt. This is an inconsistency, and basically my problem.