[wp-hackers] Is there a post content action hook?

Michael Harris harrismw at huridocs.org
Tue Oct 7 20:27:31 GMT 2008

On Tue, Oct 7, 2008 at 6:07 PM, Stephane Daury <wordpress at tekartist.org> wrote:
> On Oct 07, 2008, at 12:05, Stephane Daury wrote:
>> There's a filter, but I'm unsure on an action hook:
>> add_filter('the_content', 'your_filtering_function');
> I guess I should read the whole email before I reply. I brought no new info.
> Sorry, my bad...
No worries ;).

On Tue, Oct 7, 2008 at 6:28 PM, Austin Matzko <if.website at gmail.com> wrote:
> On Tue, Oct 7, 2008 at 11:51 AM, Michael Harris <harrismw at huridocs.org> wrote:
>> I wish to display information before or after a post using a plugin,
>> and it is not feasible to use themes, due to the fact that the plugin
>> is meant to be generic (and not tied to one theme).
> Here's how you can get around this:
> function content_changing_function($text) {
>  [... change content stuff here ...]
> }
> add_filter('get_the_excerpt', create_function('$t',
> 'remove_filter("the_content", "content_changing_function"); return
> $t;'), 9);
> add_filter('get_the_excerpt', create_function('$t',
> 'add_filter("the_content", "content_changing_function"); return $t;'),
> 11);
> add_filter('the_content', 'content_changing_function');
> This removes content_changing_function as a callback for "the_content"
> right before "the_content" is applied to the excerpt.

Thanks, that works fine (it changes quotes to numeric character
references (HTML character encoding) e.g. &#8221; or is that
WordPress?, but I don't mind).

I don't understand how it works at all. but works it does.

Thank you for not making me pull my hair out any more!


More information about the wp-hackers mailing list