Do you wish to display your author’s Twitter and Facebook hyperlinks on your WordPress profile page? Unfortunately, WordPress user profile page does not have any fields to add Facebook or Twitter profiles by default. But to help you ease things out, we have come with a short tutorial showing how you can easily display an author’s Twitter and Facebook in WordPress with Yoast SEO. So, without any further ado, let’s get right into the tutorial.
Display an Author’s Twitter and Facebook in WordPress with Yoast SEO
First of all, you need to install the Yoast SEO plugin from wordpress.org. And if you are already using Yoast SEO plugin on your website, then you are in luck as it can be used to add Twitter and Facebook profile fields in an author’s profile page.
However, the problem is that Yoast does not automatically display them in the author’s bio. Therefore, we are going to show you how you can add them manually.
Once you have set up the Yoast plugin, you need to visit your WordPress dashboard and then click Users > All Users page. Then, click on the edit link below the author’s name.
You might notice new Facebook and Twitter profile fields on the user’s profile page.
For Twitter, you just need to enter the user handle without “@” symbol. And for Facebook, you will need to enter the complete Facebook profile URL.
Once you are done pasting the URLs on their respective fields, click on the update profile button to store your changes. Now, you need to display these fields as links in your theme. You can do this by adding the following code to your theme files where you want to display the author profile links.
<?php $twitter = get_the_author_meta( 'twitter', $post->post_author ); $facebook = get_the_author_meta( 'facebook', $post->post_author ); echo '<a href="https://twitter.com/' . $twitter .'" rel="nofollow" target="_blank">Twitter</a> | <a href="'. $facebook .'" rel="nofollow" target="_blank">Facebook</a>'; ?>
Save your modifications and view a post on your website written by the author you just modified.
Here is how it will look after you save all your changes.
We hope this article helped you learn how you can display an author’s Twitter and Facebook in WordPress with Yoast SEO.
If you have anything to add or share, feel free to drop your comments down below.
Reference: WP Beginner