wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_dashboard_on_this_day_postbox_classes › WordPress Function

Since7.1.0
Deprecatedn/a
wp_dashboard_on_this_day_postbox_classes ( $classes )
Parameters:
  • (string[]) $classes An array of postbox classes.
    Required: Yes
Returns:
  • (string[]) Filtered postbox classes.
Defined at:
Codex:

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.


Source

function wp_dashboard_on_this_day_postbox_classes( $classes ) {
	if ( empty( wp_dashboard_on_this_day_get_posts() ) ) {
		$classes[] = 'hidden';
	}

	return $classes;
}