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 4 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.




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