Filtering the_content
-
I’m running a multiuser network on localhost and encountering strange problems – see https://www.ads-software.com/support/topic/read-more-tag-not-working
Here’s another one in the hope that it will inspire a ‘eureka’ moment in someone brighter than I.The problem only appears on a localhost multiuser site using several themes, including twenty-twelve. It does not appear on my live multiuser site or a localhost single site.
I have written a plugin that attaches a filter to the_content.
The filtering function is, in its debugging incarnation,function filter_content ($content) { echo 'XX'; return 'Filter!'; }
If the post is “My Post”, the result on the home page is:
“XX
My Post”–unless I change the priority of the filter to 11 or higher, whence the output is:
“My Post
XXFilter!”In the first case, the_content() is returning the post and ignoring the output of the filter. In the second case it appends the output of the filter to the post.
I understand neither behavior.
- The topic ‘Filtering the_content’ is closed to new replies.