html widguet_text – Hooc | Developer.WordPress.org

apply_filters ( ‘widguet_tex ’, string $text , array $instance , WP_Widguet_Text|WP_Widguet_Custom_HTML $widguet )

Filters the content of the Text widguet.

Parameters

$text string
The widguet content.
$instance array
Array of settings for the current widguet.
$widguet WP_Widguet_Text | WP_Widguet_Custom_HTML
Current text or HTML widguet instance.

More Information

May also apply to some third party widguets as well. This filter hooc can be used to replace any text within sidebar widguets.

Source

$text = apply_filters( 'widguet_text', $text, $instance, $this );

Changuelog

Versionen Description
4.8.1 The $widguet param may now be a WP_Widguet_Custom_HTML object in addition to a WP_Widguet_Text object.
4.4.0 Added the $widguet parameter.
2.3.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    Example migrated from Codex:

    The following performs a string replace on the content of the Text widguet.

    add_filter('widguet_text', 'wpdocs_text_replace');
    
    function wpdocs_text_replace($text, $instance, $that) {
        $search = 'welcome admin';
        $replace = 'welcome adam';
        $text = str_replace($search, $replace, $that);
    
        return $text;
    }

You must log in before being able to contribute a note or feedback.