widget_title filter to remove default value
-
This is in the hardcode of a plugin for a widget title (woocommerce plugin):
$title = apply_filters(‘widget_title’, empty( $instance[‘title’] ) ? __( ‘Product Categories’, ‘woocommerce’ ) : $instance[‘title’], $instance, $this->id_base);
I would prefer not to use a title for a widget but unfortunately there is no option and if you leave the title blank then a default ‘Product Categories’ is used, as shown in the code above.
Can you let me know a filter function to remove this default value, so I am able to have no title for this widget?
I’ve tried the following with no luck because the variables (such as $this) isn’t passed. I think I’m on the right track though:
function custom_widget_title() { $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);return $title; } add_filter('widget_title', 'custom_widget_title');
Many thanks,
Steven
- The topic ‘widget_title filter to remove default value’ is closed to new replies.