Understanding apply_filters

Well, apply_filter creates a global filter hook which can be used dynamically all over the system. Which gives you the ability to filter the content of the $instance['title'], means you can over ride the content as well as can modify the content. Here is the example-

add_filter( 'widget_title', 'widget_title_to_uppercase', 10, 1);
function widget_title_to_uppercase( $content ){
    $content = strtoupper($content);
    return $content;
}

Now all the widget title will be uppercase. So with this filter hook you can filter the widget_title from any where the WordPress system. But with the $instance['title'] it is not possible.

Leave a Comment