The dashboard_primary_title WordPress PHP filter allows you to modify the primary link title for the ‘WordPress Events and News’ dashboard widget.
Usage
add_filter('dashboard_primary_title', 'custom_dashboard_primary_title'); function custom_dashboard_primary_title($title) { // your custom code here return $title; }
Parameters
$title
(string) – Title attribute for the widget’s primary link.
More information
See WordPress Developer Resources: dashboard_primary_title
Examples
Change the Primary Link Title
Modify the primary link title for the ‘WordPress Events and News’ dashboard widget.
add_filter('dashboard_primary_title', 'change_primary_link_title'); function change_primary_link_title($title) { $title = 'Custom Title'; return $title; }
Add Prefix to the Primary Link Title
Add a prefix to the primary link title.
add_filter('dashboard_primary_title', 'add_prefix_to_title'); function add_prefix_to_title($title) { $prefix = 'News: '; $title = $prefix . $title; return $title; }
Add Suffix to the Primary Link Title
Add a suffix to the primary link title.
add_filter('dashboard_primary_title', 'add_suffix_to_title'); function add_suffix_to_title($title) { $suffix = ' - Latest Updates'; $title = $title . $suffix; return $title; }
Make Primary Link Title Uppercase
Convert the primary link title to uppercase.
add_filter('dashboard_primary_title', 'uppercase_primary_link_title'); function uppercase_primary_link_title($title) { $title = strtoupper($title); return $title; }
Replace a Word in the Primary Link Title
Replace a specific word in the primary link title.
add_filter('dashboard_primary_title', 'replace_word_in_title'); function replace_word_in_title($title) { $title = str_replace('WordPress', 'MyWebsite', $title); return $title; }