Administration: Always display the On This Day dashboard widget - #12575
Administration: Always display the On This Day dashboard widget#12575i-am-chitti wants to merge 12 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Thanks @i-am-chitti for the PR!
Overall look solid to me.
# Conflicts: # tests/phpunit/tests/admin/wpDashboardOnThisDay.php
There was a problem hiding this comment.
Pull request overview
This PR updates the “On This Day” Dashboard widget behavior so it is always displayed (and therefore consistently represented in Screen Options), showing an existing placeholder message when there are no matching posts for the current calendar day.
Changes:
- Removes the postbox-class filter mechanism that previously added the core
hiddenclass when there were no matching posts. - Updates the widget setup/rendering documentation and inline comments to reflect the “always visible; placeholder when empty” behavior.
- Updates PHPUnit tests by removing coverage that asserted the old “hide when empty” behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/phpunit/tests/admin/wpDashboardOnThisDay.php | Updates tests to stop asserting the removed postbox-class filter behavior. |
| src/wp-admin/includes/dashboard-on-this-day.php | Removes the hidden-class filter and updates documentation/comments to match always-visible behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The setup function only wrapped a single wp_add_dashboard_widget() call, which added an indirection every other core dashboard widget does without. Registering the widget directly in wp_dashboard_setup() keeps the On This Day widget consistent with At a Glance, Activity, and Quick Draft. The file guard now checks for wp_dashboard_on_this_day(), the render callback that remains in dashboard-on-this-day.php. The two unit tests for the removed function only asserted that wp_add_dashboard_widget() had been called, which no other core widget is tested for, so they are dropped along with their now unused helpers. Query and rendering behavior stays covered by the remaining tests. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
tests/phpunit/tests/admin/wpDashboardOnThisDay.php:103
- The PR changes how the widget is registered (now directly in wp_dashboard_setup()) and removes the postbox class filter, but there is no test exercising the updated registration path. Adding a small integration-style test that calls wp_dashboard_setup() would cover the regression reported in #65647 (widget always registered/visible via Screen Options, and no hidden postbox filter).
/**
* @ticket 65116
*
* @covers ::_wp_dashboard_on_this_day_date_query_clause
*/
public function test_get_date_query_clause_includes_february_29_on_february_28_in_non_leap_year() {
src/wp-admin/includes/dashboard-on-this-day.php:17
- Removing wp_dashboard_on_this_day_setup() entirely is a backward-compatibility break for any code that might have called it since it was introduced in 7.1.0. Consider keeping it as a thin wrapper that only registers the widget (without adding any
hiddenclass behavior), so existing callers don’t fatally error while still achieving the “always show” behavior.
/**
* Renders the On This Day dashboard widget.
*
* Outputs the matching posts grouped by publication year, newest year first.
*
* @since 7.1.0
*/
function wp_dashboard_on_this_day() {
|
I've been thinking about this, and I'm leaning towards supporting this PR that always displays the On This Day widget. @m suggested hiding the On This Day widget entirely when there's no content to display. However, implementing this presents some tricky challenges. A significant issue is that the widget might be visually absent, yet its checkbox in the Screen Options would still appear.
While we can hide the "On This Day" checkbox within Screen Options, it requires a somewhat convoluted approach. Furthermore, the current behavior might be perceived as a bug. Please refer to this livestream by Ryan. https://www.twitch.tv/videos/2821389287?t=42m35s @annezazu @joedolson, I plan to move forward with this PR, what are your thoughts? |
|
I agree with this. Ultimately, hiding it creates a lot of technical problems that are largely unnecessary, and creates a user experience that's potentially confusing. I feel like the text should be more invitational; something like "You haven't published a post on this day before. Write one now, and be reminded about it next year!" But I think getting some copy work on this would be good; and we need to nail that down by RC, for translators sakes. |
joedolson
left a comment
There was a problem hiding this comment.
Barring polish on the text, I think that this is ready to go. I think it would be fine to commit with the text suggested by @annezazu, and continue to discuss; but if anybody has suggestions on the text that we can land on before RC 1, that would be great.
|
I like your text more than mine (and don’t feel strongly). Another option: “No posts were published on this day in previous years. Write one today, and be reminded about it next year.” |
|
I like the prompt by @joedolson - "Write one today, and be reminded about it next year". But ideally, if published on the day, it will be shown next year on same date. So, I guess it should be "Publish one today, and be reminded about it next year". Let me know once copy is finalized. I will do the final copy update quickly. |
|
I see the dashboard as an area that is meant to focus on the customers site to where they can gain useful information. On keeping On This Day dashboard widget....not sure I see the use in that...sorry. I do see it kind of like a history widget though. Like a curiosity... |
|
Things moving fast here, good work all around. I'll try and respond primarily to the ping on the empty-state. Which is to say, in the current context and widget implementation, it largely works to prompt and explain. It's a pity we can't hide it when it's empty: I endorse moving forward without that feature in the name of iteration, but nevertheless I want to acknowledge the instinct: when it's populated it's a moment of delight. When it's empty, it's a question: why is this here? Not blocking, but encouraging future iteration in this space. And it's extra context for tweaking the help text, because for me it suggests that the text should be as minimal as possible, so that it serves as the lightest write-prompt+explanation we can muster, but otherwise reduce its footprint so it doesn't annoy. In that sense, we could go one of these directions:
I can understand an argument to want to stay verbose afterall: on a big screen two lines of text might not feel like a lot. But the problem is: on many blogs, and certainly many static sites that aren't used as blogs, you'll see this text a lot, which is why I'm leaning towards less text. (Also a question: can we/is the widget already hidden if a site has no posts at all?) Nevertheless if you want the more verbose text, you could go in one of these directions:
|
|
Many widgets are only useful to some users - the majority of users will never attend a WordPress event and are unconcerned with WordPress news. I don't think we need to concern ourselves too much with whether or not all users will benefit from it. Users who use the dashboard at all will customize it to their needs - other users won't use it, and it will make little difference to them what's there. I don't particularly like using 'empty'; it doesn't feel very friendly to me. I'm also not thrilled with "Write something worth revisiting", as it puts unnecessary pressure by setting a value judgement on publishing. My preference from above would be "Nothing here yet. [Write today's post]." Short and to the point. |
Now that the widget is always displayed, its empty state is seen far more often, including on sites that rarely publish. The previous sentence only stated a fact and offered no way forward, so it is replaced with a shorter, invitational message that links straight to the new post screen. The link is only rendered for users who can create posts; everyone else sees the message on its own.
I tried this. |
|
I don't think that really connects what the widget does though and we need to assume folks need that connection. I'd prefer we go with this:
I think it matches a friendliness in our interface that we shouldn't be afraid to have (think "hello dolly" vibes), especially when looking at the approach for the events widget that asks people to consider organizing an event. |
The shortened "Nothing here yet." message dropped the connection to what the widget actually does, leaving no explanation of why the area is empty. The original sentence is restored and the invitation to publish is folded into it, so the empty state both explains itself and offers a way forward. Co-Authored-By: Claude <noreply@anthropic.com>
I have changed the wording. I don't have a strong opinion on the phrasing, but in any case, it might be best to commit this PR towards RC1 and gather user feedback. |
Go for it @t-hamano |
joedolson
left a comment
There was a problem hiding this comment.
The tests didn't merge cleanly, and will need some re-working after https://core.trac.wordpress.org/changeset/62968
I'm out of time for today, so I'm moving this out of commit for the moment.
The excerpt tests added in trunk call a set_up_dashboard_screen() helper that this branch removed, since registering the widget by hand is no longer needed now that it is always displayed. Merging the two left the calls without their helper and the tests errored out. The helper is not restored, because only one part of it still matters: outside the admin, get_the_title() prefixes private and password protected posts with "Private:" / "Protected:", so an untitled post no longer looks untitled and the "(no title)" fallback never renders. The widget only ever runs on the dashboard, so the screen is now set once in set_up() for the whole class rather than per test. WP_UnitTestCase resets the current screen globals on tear down, so no cleanup is required. Co-Authored-By: Claude <noreply@anthropic.com>
The dashboard is the only screen this widget renders on, so setting it in the test set up needs no explanation. Other tests that put set_current_screen() in set_up() leave it unannotated as well. Co-Authored-By: Claude <noreply@anthropic.com>
|
The unit test failures should be resolved now. |
While the intention was to only render the On This Day widget when it returned results, this proved to create a variety of implementation complications and some significant points of confusion for users. Remove the conditional rendering of the On This Day widget. When active without posts, display a message inviting the user to publish a new post. Developed in #12575 Props iamchitti, mirmpro, shailu25, ugyensupport, iamraju, nazmulasif, wildworks, joedolson, mukesh27, annezazu, paaljoachim, joen. Fixes #65647. git-svn-id: https://develop.svn.wordpress.org/trunk@62977 602fd350-edb4-49c9-b593-d223f7449a82
While the intention was to only render the On This Day widget when it returned results, this proved to create a variety of implementation complications and some significant points of confusion for users. Remove the conditional rendering of the On This Day widget. When active without posts, display a message inviting the user to publish a new post. Developed in WordPress/wordpress-develop#12575 Props iamchitti, mirmpro, shailu25, ugyensupport, iamraju, nazmulasif, wildworks, joedolson, mukesh27, annezazu, paaljoachim, joen. Fixes #65647. Built from https://develop.svn.wordpress.org/trunk@62977 git-svn-id: http://core.svn.wordpress.org/trunk@62218 1a063a9b-81f0-0310-95a4-ce76da25c4cd











Trac ticket
https://core.trac.wordpress.org/ticket/65647
Problem
The On This Day dashboard widget is hidden with the core
hiddenclass when there are no posts to show for the current calendar day. This creates inconsistent, confusing behavior:postbox.jscalls jQuery's.show(), which injects an inlinedisplay: blockthat overrides the.hiddenclass.The root cause is two independent hide mechanisms competing: a server-side
hiddenclass vs. the persisted per-user Screen Options preference.Fix
Take the "always show" approach (option 1 from the ticket):
postbox_classes_dashboard_wp_dashboard_on_this_dayfilter and thewp_dashboard_on_this_day_postbox_classes()function that added thehiddenclass.This is consistent with other always-registered dashboard widgets (e.g. Activity, At a Glance) and avoids
!importantCSS hacks.Testing instructions
Screenshots
Before
After
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 4.8
Used for: update unit tests