wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_dashboard_on_this_day_get_posts › WordPress Function
Seit7.1.0
Veraltetn/v
› wp_dashboard_on_this_day_get_posts ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
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 abefore 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.Quellcode
function wp_dashboard_on_this_day_get_posts() {
$today = current_datetime();
$year = (int) $today->format( 'Y' );
$date_query = array(
'relation' => 'AND',
array(
'before' => array( 'year' => $year ),
),
_wp_dashboard_on_this_day_date_query_clause( $today ),
);
$args = array(
'post_type' => 'post',
'post_status' => array( 'publish' ),
'posts_per_page' => 10,
'ignore_sticky_posts' => true,
'orderby' => 'date',
'order' => 'DESC',
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'date_query' => $date_query,
);
/**
* Filters the arguments used to query posts for the On This Day dashboard widget.
*
* @since 7.1.0
*
* @param array $args WP_Query arguments.
*/
$args = apply_filters( 'wp_dashboard_on_this_day_query_args', $args );
$query = new WP_Query( $args );
return $query->posts;
}