Skip to content

Commit 64ede44

Browse files
authored
Set $author and $title variables
for use as parameters in `the_author_posts_link` hook
1 parent 2e652a9 commit 64ede44

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/wp-includes/author-template.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function the_author_meta( $field = '', $user_id = false ) {
229229
* the author's name.
230230
*
231231
* @since 3.0.0
232-
* @since 6.8.0 Added `$use_title_attr` parameter.
232+
* @since 7.0.0 Added `$use_title_attr` parameter.
233233
*
234234
* @global WP_User $authordata The current author's data.
235235
*
@@ -278,7 +278,7 @@ function get_the_author_link( $use_title_attr = true ) {
278278
* @link https://developer.wordpress.org/reference/functions/the_author_link/
279279
*
280280
* @since 2.1.0
281-
* @since 6.8.0 Added `$use_title_attr` parameter.
281+
* @since 7.0.0 Added `$use_title_attr` parameter.
282282
*
283283
* @param bool $use_title_attr Optional. Whether to add a title attribute.
284284
* Default true.
@@ -318,6 +318,7 @@ function the_author_posts() {
318318
* Returns an HTML-formatted link using get_author_posts_url().
319319
*
320320
* @since 4.4.0
321+
* @since 7.0.0 Removed title attribute.
321322
*
322323
* @global WP_User $authordata The current author's data.
323324
*
@@ -330,20 +331,27 @@ function get_the_author_posts_link() {
330331
return '';
331332
}
332333

334+
$author = get_the_author();
335+
/* translators: %s: Author's display name. */
336+
$title = sprintf( __( 'Posts by %s' ), $author );
337+
333338
$link = sprintf(
334339
'<a href="%1$s" rel="author">%2$s</a>',
335340
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
336-
get_the_author()
341+
$author
337342
);
338343

339344
/**
340345
* Filters the link to the author page of the author of the current post.
341346
*
342347
* @since 2.9.0
348+
* @since 7.0.0 Added `$author` and `$title` parameters.
343349
*
344-
* @param string $link HTML link.
350+
* @param string $link HTML link.
351+
* @param string $author Author's display name.
352+
* @param string $title Text originally used for a title attribute.
345353
*/
346-
return apply_filters( 'the_author_posts_link', $link );
354+
return apply_filters( 'the_author_posts_link', $link, $author, $title );
347355
}
348356

349357
/**

0 commit comments

Comments
 (0)