Using WordPress ‘dashboard_secondary_title’ PHP filter

The dashboard_secondary_title WordPress PHP filter allows you to modify the secondary link title for the ‘WordPress Events and News’ dashboard widget.

Usage

add_filter('dashboard_secondary_title', 'my_custom_dashboard_secondary_title');
function my_custom_dashboard_secondary_title($title) {
    // your custom code here
    return $title;
}

Parameters

  • $title (string): Title attribute for the widget’s secondary link.

More information

See WordPress Developer Resources: dashboard_secondary_title

Examples

Change the secondary link title for the ‘WordPress Events and News’ dashboard widget to ‘My Custom Title’.

add_filter('dashboard_secondary_title', 'change_dashboard_secondary_title');
function change_dashboard_secondary_title($title) {
    $title = 'My Custom Title';
    return $title;
}

Add a prefix ‘New: ‘ to the secondary link title for the ‘WordPress Events and News’ dashboard widget.

add_filter('dashboard_secondary_title', 'add_prefix_to_dashboard_secondary_title');
function add_prefix_to_dashboard_secondary_title($title) {
    $title = 'New: ' . $title;
    return $title;
}

Convert the secondary link title for the ‘WordPress Events and News’ dashboard widget to uppercase.

add_filter('dashboard_secondary_title', 'make_dashboard_secondary_title_uppercase');
function make_dashboard_secondary_title_uppercase($title) {
    $title = strtoupper($title);
    return $title;
}

Append the current date to the secondary link title for the ‘WordPress Events and News’ dashboard widget.

add_filter('dashboard_secondary_title', 'add_date_to_dashboard_secondary_title');
function add_date_to_dashboard_secondary_title($title) {
    $date = date('Y-m-d');
    $title .= ' - ' . $date;
    return $title;
}

Remove all vowels from the secondary link title for the ‘WordPress Events and News’ dashboard widget.

add_filter('dashboard_secondary_title', 'remove_vowels_from_dashboard_secondary_title');
function remove_vowels_from_dashboard_secondary_title($title) {
    $title = preg_replace('/[aeiou]/i', '', $title);
    return $title;
}