How to process content in a widget? [duplicate]

Possible Duplicate:
Is There A Hook To Process The Content Of The Text Widget?

I have created a plugin that uses tokens in the body content to dynamically insert certain content. For example:

%%keyword%%

At page request, that would get replaced with a keyword specified in the incoming URL.

I would like to be able to use these tokens in a widget and have them processed the same, but my plugin only knows about the_content and I haven’t been able to figure out, how to tell it to parse the content of widgets as well, before final page render.

How would this be done? I suppose it can be done more easily with shortcodes, but I’d like to stay consistent with my token usage.

Appreciate any suggestions!

EDIT:

Minutes after posting I found this post which has given me what I need:

Is There A Hook To Process The Content Of The Text Widget?

Thanks anyway all!

2 Answers
2

The filter you’re looking for is widget_text. From the Codex:

widget_text
applied to the widget text of the WordPress Text widget. May also apply to some third party widgets as well.

Leave a Comment