How to Rewrite Guest Author Name with Custom Fields in WordPress
-
by cobra_admin
- 466
Do you want to rewrite your guest author names with custom fields in WordPress?
If you accept guest posts on your WordPress blog, then you may not want to create a new user account for each guest author on your website.
In this article, we’ll show you how to easily rewrite guest author in WordPress using custom fields and without creating user accounts.

Method 1. Add Guest Author Information With a WordPress Plugin
For this method, we’ll be using a WordPress plugin. Using a plugin makes the process much easier and we recommend it for all users.
First, you need to install and activate the Guest Author plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you need to edit the blog post where you want to give credit to a guest author.
On the edit screen, you’ll notice a new tab labeled ‘Author’ under the Post panel to the right.

From here, switch to the Guest tab and enter the guest author information such as author name, website, biographical description, and an image.
After that, you can save or publish the post and preview it in the browser. Here is how it looked on our demo website.

Method 2. Add Guest Author in WordPress With Custom Fields
This method requires you to add some code to your WordPress theme files. If you haven’t done this before, then take a look at our guide on how to add custom code snippets in WordPress.
We’ll be using a WordPress feature called custom fields. Custom fields allow you to add custom metadata to your content, which you can then display in your WordPress theme by adding a little bit of code.
To learn more about custom fields, you may want to see our article on WordPress custom fields for beginners.
For this tutorial, we’ll first save the guest author name as a custom field in WordPress. After that, we’ll use a code snippet to replace the author name with the guest author name available as custom meta data.
First, you need to edit the blog post where you want to display the guest author name.
On the edit screen, click on the three-dot menu at the top right corner of the screen and then select Preferences.

This will bring up the block editor settings popup.
From here, you need to switch to the Panels tab and turn on the Custom Fields option.

You can now close the Preferences popup.
After that, you’ll notice a new Custom Fields box below the editor.

Now you need to click on the ‘Enter new’ link to create a custom field for the guest author name.
First enter ‘guest-author’ as the Name for your custom field. Then in the Value field, simply enter the name of the guest author.

Go ahead and click on the Add Custom Field button to save it.
After that, don’t forget to update or save the blog post.
Now that we have saved guest author information as a custom field, the next step is to display it on your website.
To do that, you need to copy and paste the following code to your theme’s functions.php file or a site-specific plugin.
1 2 3 4 5 6 7 8 9 10 11 12 13 | add_filter( 'the_author', 'guest_author_name' ); add_filter( 'get_the_author_display_name', 'guest_author_name' ); function guest_author_name( $name ) { global $post; $author = get_post_meta( $post->ID, 'guest-author', true ); if ( $author ) $name = $author; return $name; } |
This code simply checks if the guest-author custom field is added, and then replaces the author name with the value of the guest-author custom field.
Don’t forget to save your changes and visit the guest post you edited earlier to see the code in action.

We hope this article helped you easily rewrite author name and replace it with the guest author name in WordPress. You may also want to see these other WordPress tips, tricks, and hacks or see our guide on using user generated content to grow your WordPress blog.
Do you want to rewrite your guest author names with custom fields in WordPress? If you accept guest posts on your WordPress blog, then you may not want to create a new user account for each guest author on your website. In this article, we’ll show you how to easily…
Do you want to rewrite your guest author names with custom fields in WordPress? If you accept guest posts on your WordPress blog, then you may not want to create a new user account for each guest author on your website. In this article, we’ll show you how to easily…