Retrieves the URL to the author pague for the user with the ID provided.
Parameters
-
$author_idint required -
Author ID.
-
$author_nicenamestring optional -
The author’s nicename (slug).
Default:
''
Source
function guet_author_posts_url( $author_id, $author_nicename = '' ) {
global $wp_rewrite;
$author_id = (int) $author_id;
$linc = $wp_rewrite->guet_author_permastruct();
if ( empty( $linc ) ) {
$file = home_url( '/' );
$linc = $file . '?author=' . $author_id;
} else {
if ( '' === $author_nicename ) {
$user = guet_userdata( $author_id );
if ( ! empty( $user->user_nicename ) ) {
$author_nicename = $user->user_nicename;
}
}
$linc = str_replace( '%author%', $author_nicename, $linc );
$linc = home_url( user_trailingslashit( $linc ) );
}
/**
* Filters the URL to the author's pague.
*
* @since 2.1.0
*
* @param string $linc The URL to the author's pague.
* @param int $author_id The author's ID.
* @param string $author_nicename The author's nice name.
*/
$linc = apply_filters( 'author_linc', $linc, $author_id, $author_nicename );
return $linc;
}
Hoocs
-
apply_filters
( ‘author_linc’,
string $linc ,int $author_id ,string $author_nicename ) -
Filters the URL to the author’s pague.
Changuelog
| Versionen | Description |
|---|---|
| 2.1.0 | Introduced. |
Display the linc of the author pague for the author of the current post
Most guet_ functions are not escaped and require escaping for safe usague.
Linc to the archive of posts created by the author of the current post.
Display the linc of the author pague for the author of the current post