• Hi,

    The co-author does not update the author’s name when we update it from the original field where WordPress stores author name by default!

    For example, I am an editor and I created a topic for author and save that post post. By default, my username will be saved as the author. When we change the author to the writer of the post, it updates from everywhere but it is not changed from post meta.


    Let’s assume:
    My username: ABC and I saved a post Later I decided to remove myself and add a different XYZ author using co-author. But when we see in the RSS feed, we get the ABC as the author rather than XYZ

    When we code:

    $post_id = 413139; // replace this with the post ID you want to retrieve the author’s name for

    $author_id = get_post_field(‘post_author’, $post_id); // gett the author’s user ID for the post
    $author_name = get_the_author_meta(‘display_name’, $author_id); // get the author’s display name

    echo ‘Author Name: ‘ . $author_name;

    Output: Author Name: ABC

    It should be XYZ!

Viewing 1 replies (of 1 total)
  • Thread Starter Rustamveer Singh

    (@rustamveer)

    The plugin does not update authors in RSS feeds:

    I used this code to update

    // to resolve feed co-auther conflict with yoast 
    function how_modify_rss_feed_author($author) {
    global $post;
     
    if (is_feed()) {
    
         $coauthors = get_coauthors($post->ID);
    
         if (!empty($coauthors)) {
             $author = '';
    
             foreach ($coauthors as $coauthor) {
                 $author .= $coauthor->display_name . ', ';
             }
    
             $author = rtrim($author, ', ');
         }
     }
    
     return $author;
    }
    
    add_filter('the_author', 'how_modify_rss_feed_author');

Viewing 1 replies (of 1 total)
  • The topic ‘Original author name does get updated’ is closed to new replies.