How to Make a Clickable External link from WordPress Featured Image Post

Posted on

If you are looking for a way to make external link clickable from your featured image this is your lucky day, because I am going to show you step by step how to do it easily.

Note: This is not a featured image that look for image from other sites ( you just put URL instead of upload picture yourself). If you are looking for this features there are many plugin doing this you can look here:

Let see the picture below and you will see what I mean here:

Clickable External Link From WordpressThe link this sample page is
OK let’s get to the point how we can add external link to featured image like above sample.

1. Change code on your theme

You need to change a code on your wordpress theme. Every theme is different but the principal is the same. On my sample here I am using Theme MH Purity lite 1.2.0 Open

Open MH function file - Clickable External Link From WordpressOpen mh-functions.php file

The original code is:

$attachment_page = get_attachment_link(get_post_thumbnail_id());

original code - Clickable External Link From Wordpress

Modify the code to become:

$attachment_page = get_posts_meta($post->ID, ‘ExternalUrl’, true);

code after modified - Clickable External Link From Wordpress

2. Add custom fields on your post

You need to add a custom fields called ExternalURL on the post you want to insert external URL. Scroll down the window of until you find custom fields. If you cannot find custom fields Click Screen options on the top right side. Make sure there is check mark on the customs Fields.

screen option - Clickable External Link From Wordpressscreen option 2 - Clickable External Link From Wordpress

After you can see custom fields on bottom area of post editor, click Enter new text

Type ExternalURL on the name field

Type your URL on the Value field, the one who will become clickable on the featured picture.

Click Add Custom Field button.
add custom field - Clickable External Link From Wordpress
Publish or update your post.

The result is your featured image is now link to your link, you can use affiliate link or anything.

This post was inspired from WP forum by Michael here:

I hope that you like this post “How to Make a Clickable External link from WordPress Featured Image Post” please share with other If you think it’s useful.

Read: Disqus Comment on WordPress is not Working, Solved

Facebook Comments