wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_dashboard_on_this_day_get_posts › WordPress Function
Seit7.2.0
Veraltetn/v
› wp_dashboard_on_this_day_get_posts ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Retrieves posts published on this calendar day in previous years.
Up to ten posts are returned by default. Use the {@see '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' );
$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' => array(
'relation' => 'AND',
array(
'before' => array( 'year' => $year ),
),
_wp_dashboard_on_this_day_date_query_clause( $today ),
),
);
/**
* Filters the arguments used to query posts for the On This Day section.
*
* @since 7.2.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;
}