the_author function is displaying wrong name and url

Sorry, but I found the answer very quickly myself and I attempted to delete this original question, but I think maybe somebody else may need this answer. This is right code to solve this issue: <h1 class=”page-title”> <?php echo ‘<a href=”‘.get_author_posts_url(get_userdata($posts[0]->post_author)->data->ID).'”>’.get_userdata($posts[0]->post_author)->data->display_name.'</a>’; ?></h1>

How to load locally saved author photos based on author ID

One option is to use the pre_get_avatar filter to return custom avatar HTML, which will short-circuit get_avatar() preventing it from reaching out to Gravatar for the image. For example like this, add_filter(‘pre_get_avatar’, ‘wpse_410434_author_img_html’, 10, 3); function wpse_410434_author_img_html( $avatar, $id_or_email, $args ) { if ( $avatar || ! is_numeric( $id_or_email ) ) { return $avatar; } … Read more

why is there an author.php

From the Codex: …when a viewer clicks on a link to a post author, by default he or she is taken to a page listing the posts from that particular author in chronological order, from newest posts at the top to oldest at the bottom. In other words, the author template is used to show … Read more

Replace author with custom field in feed

try this: add_filter( ‘the_author’, ‘feed_author’ ); function feed_author($name) { if( is_feed() && !is_admin()) { global $post; $author = get_the_terms($post->ID,’article_author’); if ( $author ) $name = the_terms($post->ID,’article_author’,”,’ & ‘); return $name; } }

Uncode theme, create author page and author link under the blog

before making edits, please consider to create a child theme for your customization; https://developer.wordpress.org/themes/advanced-topics/child-themes/ to show a link to the author’s page (https://developer.wordpress.org/reference/functions/get_author_posts_url/), put this code into the loop of the blog or post template file below the blog post code (please contact the theme’s developer for help with where in what file of your … Read more

Show the most recent post for an author on the author page

Basic debugging… $current_author = get_query_var(‘author’); var_dump($current_author); … would reveal that $current_author is a string, not an object. The problem is that you are trying to use the string as an object in the query. get_posts( ‘author=”.$current_author->id.”&posts_per_page=1&order=DESC&orderby=post_date’ ); Change $current_author->id to $current_author and the query works. $author_posts = get_posts( ‘author=”.$current_author.”&posts_per_page=1&order=DESC&orderby=post_date’ );

error code: 523