Make WordPress Core

Changeset 61555

Timestamp:
01/29/2026 08:08:15 PM (5 weeks ago)
Author:
joedolson
Message:

Posts, Post Types: Clarify "at a glance" Dashboard links.

"At a glance" links in the dashboard were labeled with the count of published posts, but linked to the All posts view. Change the links so that they target only the published posts list and update link text to clarify.

Props awardpress, birgire, benpinales, susiyanti, sergeybiryukov, sirlouen, noruzzaman, huzaifaalmesbah, westonruter, nikunj8866, joedolson.
Fixes #43084.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r61495 r61555  
    310310            if ( 'post' === $post_type ) {
    311311                /* translators: %s: Number of posts. */
    312                 $text = _n( '%s Post', '%s Posts', $num_posts->publish );
     312                $text = _n( '%s Posts', $num_posts->publish );
    313313            } else {
    314314                /* translators: %s: Number of pages. */
    315                 $text = _n( '%s Page', '%s Pages', $num_posts->publish );
     315                $text = _n( '%s Pages', $num_posts->publish );
    316316            }
    317317
     
    320320
    321321            if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
    322                 printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
     322                $url = add_query_arg(
     323                    array(
     324                        'post_status' => 'publish',
     325                        'post_type'   => $post_type,
     326                    ),
     327                    admin_url( 'edit.php' )
     328                );
     329                printf( '<li class="%1$s-count"><a href="%1$s">%2$s</a></li>', esc_url( $url ), esc_html( $text ) );
    323330            } else {
    324331                printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
Note: See TracChangeset for help on using the changeset viewer.