[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/includes/ -> dashboard-on-this-day.php (summary)

WordPress Dashboard "On This Day" widget.

File Size: 238 lines (7 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 5 functions

  wp_dashboard_on_this_day_setup()
  wp_dashboard_on_this_day_postbox_classes()
  wp_dashboard_on_this_day()
  wp_dashboard_on_this_day_get_posts()
  _wp_dashboard_on_this_day_date_query_clause()

Functions
Functions that are not part of a class:

wp_dashboard_on_this_day_setup()   X-Ref
Registers the On This Day dashboard widget.

Designed to be the single entry point called from the dashboard setup
routine. The widget is always registered so that it remains available in
Screen Options and keeps its user-customized position. When there are no
matching posts, a marker class is added to the postbox so the widget can be
hidden with CSS.


wp_dashboard_on_this_day_postbox_classes( $classes )   X-Ref
Hides the On This Day postbox when there are no posts to show.

Adds the core `hidden` class so the widget stays registered — preserving its
Screen Options entry and user-customized position — while being hidden when
empty. A user can still reveal it via Screen Options, in which case the
placeholder message is shown.

param: string[] $classes An array of postbox classes.
return: string[] Filtered postbox classes.

wp_dashboard_on_this_day()   X-Ref
Renders the On This Day dashboard widget.

Outputs the matching posts grouped by publication year, newest year first.


wp_dashboard_on_this_day_get_posts()   X-Ref
Retrieves published posts from all authors that were published on this
calendar day in previous years.

The date constraint matches today's month and day, combined with a
`before` clause anchored to January 1 of the current year. Up to ten posts
are returned; use the `wp_dashboard_on_this_day_query_args` filter to change
the limit. Results are cached by WP_Query's native query caching.

return: WP_Post[] Array of posts ordered by newest first.

_wp_dashboard_on_this_day_date_query_clause( $date )   X-Ref
Builds the date query clause for today's anniversary date.

On February 28 in a non-leap year, February 29 posts are included so
leap-day anniversaries still appear.

param: DateTimeInterface $date Date to build the clause for.
return: array Date query clause.



Generated : Sat Jul 11 08:20:14 2026 Cross-referenced by PHPXref