Support » Plugins » Change author that appears in RSS

Viewing 1 replies (of 1 total)
  • Found this, which is pretty much exactly what I needed.

    For anyone that might find this, my code ended up being:

    /**
     * Filters the_author.
     * If Other Author is the author of a post, changes the author to whatever is in the 'Other Author' custom field for the post, if one exists.
     * Code taken mainly from http://www.wpbeginner.com/wp-tutorials/how-to-rewrite-guest-author-name-with-custom-fields-in-wordpress/
     */
    function fix_other_author( $name ) {
            global $post;
            if ( $name == "Other Author") {
                    $author = get_metadata( 'post', $post->ID, 'Other Author', true );
                    if ( $author != '' )
                            $name = $author;
            }
            return $name;
    }
    add_filter( 'the_author', 'fix_other_author' );
    add_filter( 'get_the_author_display_name', 'fix_other_author' );

Viewing 1 replies (of 1 total)
  • The topic ‘Change author that appears in RSS’ is closed to new replies.