WordPress.org

Make WordPress Core

Ticket #27132: dashboard.php2.diff

File dashboard.php2.diff, 605 bytes (added by jackreichert, 7 years ago)

This hides future posts form inside wp_dashboard_recent_posts()

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

    diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
    index 0f62ebc..aed23b3 100644
    a b function wp_dashboard_recent_posts( $args ) { 
    606606                        $posts->the_post();
    607607
    608608                        $time = get_the_time( 'U' );
     609                        // hide future posts from users who shouldn't see them
     610                        if ($time > time() && !current_user_can('edit_post')) {
     611                                continue;
     612                        }
     613                       
    609614                        if ( date( 'Y-m-d', $time ) == $today ) {
    610615                                $relative = __( 'Today' );
    611616                        } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {