Administration: A11y: Prevent empty author link in list tables.
If the author display name is unknown, show an `emdash` and screen reader text `(no author)`, consistent with other cases where information is unknown. Fix an issue where an unknown author name displayed as an invisible link with no text. Props kkmuffme, hdkothari81, shailu25, snehapatil02, sabernhardt, faisal03, rishavdutta, sumitbagthariya16, joedolson. Fixes #62913. Built from https://develop.svn.wordpress.org/trunk@60032 git-svn-id: http://core.svn.wordpress.org/trunk@59368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -503,15 +503,22 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||
* Handles the author column output.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @since 6.8.0 Added fallback text when author's name is unknown.
|
||||
*
|
||||
* @param WP_Post $post The current WP_Post object.
|
||||
*/
|
||||
public function column_author( $post ) {
|
||||
printf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( add_query_arg( array( 'author' => get_the_author_meta( 'ID' ) ), 'upload.php' ) ),
|
||||
get_the_author()
|
||||
);
|
||||
$author = get_the_author();
|
||||
|
||||
if ( ! empty( $author ) ) {
|
||||
printf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( add_query_arg( array( 'author' => get_the_author_meta( 'ID' ) ), 'upload.php' ) ),
|
||||
esc_html( $author )
|
||||
);
|
||||
} else {
|
||||
echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . __( '(no author)' ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1277,15 +1277,22 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* Handles the post author column output.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @since 6.8.0 Added fallback text when author's name is unknown.
|
||||
*
|
||||
* @param WP_Post $post The current WP_Post object.
|
||||
*/
|
||||
public function column_author( $post ) {
|
||||
$args = array(
|
||||
'post_type' => $post->post_type,
|
||||
'author' => get_the_author_meta( 'ID' ),
|
||||
);
|
||||
echo $this->get_edit_link( $args, get_the_author() );
|
||||
$author = get_the_author();
|
||||
|
||||
if ( ! empty( $author ) ) {
|
||||
$args = array(
|
||||
'post_type' => $post->post_type,
|
||||
'author' => get_the_author_meta( 'ID' ),
|
||||
);
|
||||
echo $this->get_edit_link( $args, esc_html( $author ) );
|
||||
} else {
|
||||
echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . __( '(no author)' ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-beta2-60031';
|
||||
$wp_version = '6.8-beta2-60032';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user