Skip to content

Commit 780356e

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@61555 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1831ae9 commit 780356e

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/wp-admin/includes/dashboard.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,24 @@ function wp_dashboard_right_now() {
309309
if ( $num_posts && $num_posts->publish ) {
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 Published post', '%s Published 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 Published page', '%s Published pages', $num_posts->publish );
316316
}
317317

318318
$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
319319
$post_type_object = get_post_type_object( $post_type );
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 );
325332
}

0 commit comments

Comments
 (0)