Hide Widget Titles That Start With "!"
Lets you keep a descriptive widget title in the admin but hide it on the site, just by starting the title with an exclamation mark.
Opens WPIDE on
Code
add_filter( 'widget_title', function ( $title ) {
return ( is_string( $title ) && 0 === strpos( $title, '!' ) ) ? '' : $title;
} );
Notes
Example: a widget titled "!Newsletter form" shows no heading on the site.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.