#2: dashboard_primary_title

On Hold
— I couldn’t get this filter to work. Neither could a couple of other people, so until there’s clarification on whether it still even has a purpose, I’m going to wait.

If you’re curious … the filter is only evaluated if the dashboard_primary widget options aren’t set. And it appears that is never the case.

The dashboard_primary_title filter allows you to modify the title of the ‘WordPress Blog’ dashboard widget.

The filter is evaluated in wp_dashboard_setup() as part of the callback passed to wp_add_dashboard_widget() for creating the ‘WordPress Blog’ dashboard widget in in wp-admin/includes/dashboard.php.

Side note: As this filters a translatable string, your single-language filtered value could override a valid translation of the string. So keep that in mind.

Example:

Since we all love WordPress news, let’s say we wanted to change the name of the ‘WordPress Blog’ dashboard widget to something more awesome. The following example modifies the widget title to ‘Awesome WordPress Blog’.

Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!

3 thoughts on “#2: dashboard_primary_title

  1. This filter would run when a site is first created, so this would be most useful as a mu-plugin or (multisite only) a network-wide plugin that would filter that value the first time wp_dashboard_setup() is called. Basically, it’ll let you filter the default values, but since users can still modify those values themselves, it won’t do it after they’ve been saved already.

    • Yeah, Helen and I talked about that yesterday, I even spun up a new install to try it and couldn’t get it to work.

  2. Week 1 Recap: Filters 1-12 – Filters of the Day

Leave a Reply

Your email address will not be published. Required fields are marked *