I'm working on a plug-in that needs to intercept post data as it's being displayed and munge it. The key is that I need to get to the post before the nextpage and more tags are managed, so the_content is way to late in the chain.
I tried creating a sanitize_post_content filter, but found it was overwritten later in the chain. I tried setting a very low level filter for 'post_content'. I watched it execute through the debugger and post content properly replaced the content per my filter, but as the $value got returned and worked its way back up the call stack, the entire post_content filtering was simply ignored and the query just pulled an original copy of the field when it created $this->posts from the database, essentially overwriting all the work my filter did.
Any ideas why this might occur or how to prevent the overwriting of data? I ran the filter before pretty much everything, so I thought that perhaps I need to set a different priority, but when I tried it at priority of -1000, 1, and 10, the results were the same.
I know there's a the_post action in setup_postdata, but I'm not sure whether that's going to be overwritten later (and it's an action, not a filter, so I'm not sure if the datastructure will be passed up the chain).
Any suggestions would be appreciated.
P.S. I know I could do big-ol search/replaces during the_content, but I really do want to get to the post much earlier than that.