WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any filter which can be used in a plugin to process the content of the text widget before it is rendered?

share|improve this question
up vote 5 down vote accepted


  1. widget_text (for the text)
  2. widget_title (for the title)


function add_smiley($content) {
$new_content = '';
$new_content.= $content . ':)';
return $new_content;
add_filter('widget_text', 'add_smiley');

Note that this works only for the content so not if you have a widget with only a title.


  1. http://codex.wordpress.org/WordPress_Widgets
  2. http://stackoverflow.com/questions/1385954/do-wordpress-widget-or-sidebar-hooks-exist
  3. http://stackoverflow.com/search?q=wordpress+widget
share|improve this answer

You should be able to run a filter on widget_text. The text widget is the only one that calls the widget_text hook.


Line 380 ..

$text = apply_filters( 'widget_text', $instance['text'], $instance );

So in short, Yes! Would be the direct answer to your question. Hope that helps... :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.