Skip to main content
Login Join
Snippet · PHP

Add Widget Title Prefix Filter

Shared by Yusuf mudagal · May 3, 2026 · @widget_title

35 views
Back to Snippets

Prefixes widget titles in one place, useful for staging labels, branded widget zones, or temporary content audits.

add_filter( 'widget_title', 'wpfolks_prefix_widget_titles' );

function wpfolks_prefix_widget_titles( $title ) {
    if ( '' === trim( $title ) ) {
        return $title;
    }

    return 'Featured: ' . $title;
}
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments