Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove title attributes from Author link functions #8156

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/wp-includes/author-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,12 @@ function get_the_author_link() {
if ( get_the_author_meta( 'url' ) ) {
global $authordata;

$author_url = get_the_author_meta( 'url' );
$author_display_name = get_the_author();
$author_url = get_the_author_meta( 'url' );

$link = sprintf(
'<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
'<a href="%1$s" rel="author external">%2$s</a>',
esc_url( $author_url ),
/* translators: %s: Author's display name. */
esc_attr( sprintf( __( 'Visit %s&#8217;s website' ), $author_display_name ) ),
$author_display_name
get_the_author()
);

/**
Expand Down Expand Up @@ -318,10 +315,8 @@ function get_the_author_posts_link() {
}

$link = sprintf(
'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
'<a href="%1$s" rel="author">%2$s</a>',
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
/* translators: %s: Author's display name. */
esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
get_the_author()
);

Expand Down Expand Up @@ -531,10 +526,8 @@ function wp_list_authors( $args = '' ) {
}

$link = sprintf(
'<a href="%1$s" title="%2$s">%3$s</a>',
'<a href="%1$s">%2$s</a>',
esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ),
/* translators: %s: Author's display name. */
esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ),
$name
);

Expand Down
2 changes: 0 additions & 2 deletions tests/phpunit/tests/user/getTheAuthorPostsLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function test_get_the_author_posts_link_no_permalinks() {
$url = sprintf( 'http://%1$s/?author=%2$s', WP_TESTS_DOMAIN, $author->ID );

$this->assertStringContainsString( $url, $link );
$this->assertStringContainsString( 'Posts by Test Author', $link );
$this->assertStringContainsString( '>Test Author</a>', $link );

unset( $GLOBALS['authordata'] );
Expand All @@ -74,7 +73,6 @@ public function test_get_the_author_posts_link_with_permalinks() {
$this->set_permalink_structure( '' );

$this->assertStringContainsString( $url, $link );
$this->assertStringContainsString( 'Posts by Test Author', $link );
$this->assertStringContainsString( '>Test Author</a>', $link );

unset( $GLOBALS['authordata'] );
Expand Down
76 changes: 38 additions & 38 deletions tests/phpunit/tests/user/wpListAuthors.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {

public function test_wp_list_authors_default() {
$expected['default'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a></li>';

$this->assertSame( $expected['default'], wp_list_authors( array( 'echo' => false ) ) );
}

public function test_wp_list_authors_orderby() {
$expected['post_count'] =
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>' .
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>';
'<li><a href="' . self::$user_urls[0] . '">zack</a></li>' .
'<li><a href="' . self::$user_urls[1] . '">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a></li>';

$this->assertSame(
$expected['post_count'],
Expand All @@ -113,9 +113,9 @@ public function test_wp_list_authors_orderby() {

public function test_wp_list_authors_order() {
$expected['id'] =
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' .
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>';
'<li><a href="' . self::$user_urls[2] . '">paul</a></li>' .
'<li><a href="' . self::$user_urls[1] . '">bob</a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a></li>';

$this->assertSame(
$expected['id'],
Expand All @@ -131,9 +131,9 @@ public function test_wp_list_authors_order() {

public function test_wp_list_authors_optioncount() {
$expected['optioncount'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (2)</li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (3)</li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (1)</li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a> (2)</li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a> (3)</li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a> (1)</li>';

$this->assertSame(
$expected['optioncount'],
Expand Down Expand Up @@ -180,10 +180,10 @@ public function test_wp_list_authors_exclude_admin() {
);

$expected['exclude_admin'] =
'<li><a href="' . get_author_posts_url( 1 ) . '" title="Posts by admin">admin</a></li>' .
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>';
'<li><a href="' . get_author_posts_url( 1 ) . '">admin</a></li>' .
'<li><a href="' . self::$user_urls[1] . '">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a></li>';

$this->assertSame(
$expected['exclude_admin'],
Expand All @@ -198,9 +198,9 @@ public function test_wp_list_authors_exclude_admin() {

public function test_wp_list_authors_show_fullname() {
$expected['show_fullname'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob reno</a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul norris</a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack moon</a></li>';
'<li><a href="' . self::$user_urls[1] . '">bob reno</a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul norris</a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack moon</a></li>';

$this->assertSame(
$expected['show_fullname'],
Expand All @@ -217,10 +217,10 @@ public function test_wp_list_authors_hide_empty() {
$fred_id = self::$fred_id;

$expected['hide_empty'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' .
'<li><a href="' . get_author_posts_url( $fred_id ) . '" title="Posts by fred">fred</a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a></li>' .
'<li><a href="' . get_author_posts_url( $fred_id ) . '">fred</a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a></li>';

$this->assertSame(
$expected['hide_empty'],
Expand All @@ -235,9 +235,9 @@ public function test_wp_list_authors_hide_empty() {

public function test_wp_list_authors_echo() {
$expected['echo'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a></li>';

$this->expectOutputString( $expected['echo'] );
wp_list_authors( array( 'echo' => true ) );
Expand All @@ -249,9 +249,9 @@ public function test_wp_list_authors_feed() {
$url2 = get_author_feed_link( self::$user_ids[2] );

$expected['feed'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';

$this->assertSame(
$expected['feed'],
Expand All @@ -270,9 +270,9 @@ public function test_wp_list_authors_feed_image() {
$url2 = get_author_feed_link( self::$user_ids[2] );

$expected['feed_image'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> <a href="' . $url1 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> <a href="' . $url2 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> <a href="' . $url0 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a> <a href="' . $url1 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a> <a href="' . $url2 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a> <a href="' . $url0 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>';

$this->assertSame(
$expected['feed_image'],
Expand All @@ -294,9 +294,9 @@ public function test_wp_list_authors_feed_type() {
$url2 = get_author_feed_link( self::$user_ids[2], 'atom' );

$expected['feed_type'] =
'<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
'<li><a href="' . self::$user_urls[1] . '">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[2] . '">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li>' .
'<li><a href="' . self::$user_urls[0] . '">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';

$this->assertSame(
$expected['feed_type'],
Expand All @@ -312,9 +312,9 @@ public function test_wp_list_authors_feed_type() {

public function test_wp_list_authors_style() {
$expected['style'] =
'<a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a>, ' .
'<a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a>, ' .
'<a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a>';
'<a href="' . self::$user_urls[1] . '">bob</a>, ' .
'<a href="' . self::$user_urls[2] . '">paul</a>, ' .
'<a href="' . self::$user_urls[0] . '">zack</a>';

$this->assertSame(
$expected['style'],
Expand Down
Loading