Fall Sale! Code FALL2024 takes 25% OFF our Pro Plugins & Books »
Web Dev + WordPress + Security

Custom Widget Names with Dashboard Widgets Suite

Quick tutorial for my Dashboard Widgets Suite plugin. This post explains how to customize the DWS widget names on the Dashboard. Normally each DWS widget displays the widget name along with “Widgets Suite” and a little gear icon that links to the plugin settings. Several users have asked if there is a way to change the text, specifically how to remove the extra text and gear icon. So this article explains how to do it as of Dashboard Widgets Suite version 2.3 or better.

Customize All DWS Widget Names

To remove the gear icon and “Widgets Suite” text from all widget names/titles on the Dashboard, add the following code snippet to your theme’s functions.php file (or add via custom plugin):

// Dashboard Widgets Suite - Simplify Widget Names
function dashboard_widgets_suite_simplify_widget_names($widget_name, $widget, $suite, $link) {
	
	return $widget;
	
}
add_filter('dashboard_widgets_suite_name_control_panel', 'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_debug_log',     'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_error_log',     'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_feed_box',      'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_social_box',    'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_list_box',      'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_widget_box',    'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_system_info',   'dashboard_widgets_suite_simplify_widget_names', 10, 4);
add_filter('dashboard_widgets_suite_name_user_notes',    'dashboard_widgets_suite_simplify_widget_names', 10, 4);

So to explain what’s happening here. First we have a function that is hooked into the name of each dashboard widget. You can see below the function where filter hooks are added via the WordPress add_filter function. So basically the simple function applies to every DWS widget on the Dashboard.

Then for the function itself. First notice it is passed four arguments:

$widget_name = Full text/markup for the widget name
$widget      = Text name of the widget, e.g. "Control Panel"
$suite       = Text that says "Widgets Suite"
$link        = Markup for gear-icon settings link

These variables make it easy to customize the name of all widgets quite easily. In this specific example, the function simply returns the name of the widget, $widget. So instead of displaying the default widget names like this:

[ Dashboard Widgets Suite - Default Widget Names ]Dashboard Widgets Suite – Default Widget Names

So when the above code is added, the DWS widgets will be displayed without the “Widgets Suite” text or gear icon, like this:

[ Dashboard Widgets Suite - Custom Widget Names ]Dashboard Widgets Suite – Custom Widget Names

So the first code snippet provided above works great to customize the names of all dashboard widgets provided by the DWS plugin. The passed variables give you much control over how the widget titles/names are displayed on the dashboard. You can mix and match, swap ’em out, or do whatever. And if you still need more control..

Customize Individual Widget Names

While the previous code snippet works great to customize all widget names, it’s also possible to customize widget names individually. Here is an example that shows how to customize the name of the default “Control Panel” widget:

// Dashboard Widgets Suite - Customize Name of Control Panel
function dashboard_widgets_suite_name_control_panel($widget_name, $widget, $suite, $link) {
	
	return 'Widget Control';
	
}
add_filter('dashboard_widgets_suite_name_control_panel', 'dashboard_widgets_suite_name_control_panel', 10, 4);

As-is, this function returns the value “Widget Control” to be used as the name of the “Control Panel” widget. So the “Widgets Suite” and gear icon will not be displayed, only the text that says, “Widget Control”. Of course, you can grab/use any of the same variables as before, as they are passed to the function via the filter hook:

$widget_name = Full text/markup for the widget name
$widget      = Text name of the widget, e.g. "Control Panel"
$suite       = Text that says "Widgets Suite"
$link        = Markup for gear-icon settings link

Literally anything is possible, so you can use the variables and/or your own text/markup to customize widget names exactly as desired.

About the Author
Jeff Starr = Creative thinker. Passionate about free and open Web.
Digging Into WordPress: Take your WordPress skills to the next level.

One response to “Custom Widget Names with Dashboard Widgets Suite”

  1. I did follow your guide and it works well. I can change the widget name to the one I like. Thanks for sharing

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Banhammer: Protect your WordPress site against threats.
Thoughts
I disabled AI in Google search results. It was making me lazy.
Went out walking today and soaked up some sunshine. It felt good.
I have an original box/packaging for 2010 iMac if anyone wants it free let me know.
Always ask AI to cite its sources. Also: “The Web” is not a valid answer.
All free plugins updated and ready for WP 6.6 dropping next week. Pro plugin updates in the works also complete :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
RIP ICQ
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.