Latest Tech and Tips

How to Rewrite Guest Author Name with Custom Fields in WordPress


Have you ever before had a guest message on your blog site? How do you tackle offering the author complete debt? We have actually seen several websites where they include an author account box either over the message or listed below the message. But also with the guest author box, the author name area would certainly still reveal the website author. Some blog writers produce whole brand-new author accounts for their guest writers in order to present the best name. We believe that it is meaningless to produce additional individual accounts if you understand that this guest author will just upload as soon as.

The technique we are sharing in this short article will certainly permit you to reveal guest author’s name by just getting in a custom area in your message.

Open your functions.php documents and also paste the codes listed below:

add_filter( 'the_author', 'guest_author_name' );.
add_filter( 'get_the_author_display_name', 'guest_author_name' );.

feature guest_author_name( $name) {
international $post;.

$ author = get_post_meta( $post->> ID, 'guest-author', real );.

if ($ author ).
$ name = $author;.

return $name;.

Now whenever that you are uploading a guest message, simply see to it that you include a custom area called guest-author and also it will certainly change the author’s name with the message that you place in that custom area.


Adding guest author name in the custom field