Make WordPress Core

Ticket #37578: 37578.diff

File 37578.diff, 1.7 KB (added by pmbaldha, 10 months ago)

Added a patch using the existing 'dashboard_recent_posts_query_args' filter with support for passing the $id to wp_dashboard_recent_posts() for better control.

  • src/wp-admin/includes/dashboard.php

    diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
    index b198325f27..47007827ab 100644
    a b function wp_dashboard_site_activity() { 
    928928
    929929        echo '<div id="activity-widget">';
    930930
    931         $future_posts = wp_dashboard_recent_posts(
    932                 array(
    933                         'max'    => 5,
    934                         'status' => 'future',
    935                         'order'  => 'ASC',
    936                         'title'  => __( 'Publishing Soon' ),
    937                         'id'     => 'future-posts',
    938                 )
     931        $future_posts = wp_dashboard_recent_posts(
     932                /**
     933                 * Filter for dashboard recent posts widget.
     934                 *
     935                 * @since x.x.x
     936                 *
     937                 * @param array  $params Params for wp_dashboard_recent_posts()
     938                 * @param string Dashboard recent post widget id.
     939                 *
     940                 * @return array
     941                 */
     942                apply_filters( 'dashboard_recent_posts_query_args', array(
     943                        'max'     => 5,
     944                        'status'  => 'future',
     945                        'order'   => 'ASC',
     946                        'title'   => __( 'Publishing Soon' ),
     947                        'id'      => 'future-posts',
     948                ), 'future-posts' )
    939949        );
    940950        $recent_posts = wp_dashboard_recent_posts(
    941                 array(
    942                         'max'    => 5,
    943                         'status' => 'publish',
    944                         'order'  => 'DESC',
    945                         'title'  => __( 'Recently Published' ),
    946                         'id'     => 'published-posts',
    947                 )
     951                /**
     952                 * Filter for dashboard recent posts widget.
     953                 *
     954                 * @since x.x.x
     955                 *
     956                 * @param array  $params Params for wp_dashboard_recent_posts()
     957                 * @param string Dashboard recent post widget id.
     958                 *
     959                 * @return array
     960                 */
     961                apply_filters( 'dashboard_recent_posts_query_args', array(
     962                        'max'     => 5,
     963                        'status'  => 'publish',
     964                        'order'   => 'DESC',
     965                        'title'   => __( 'Recently Published' ),
     966                        'id'      => 'published-posts',
     967                ), 'published-posts' )
    948968        );
    949969
    950970        $recent_comments = wp_dashboard_recent_comments();