How to Automatically Make WordPress Featured Image Link to Post

In most of the WordPress themes the Post Title and the Featured image is linked to the post. But if you are using a theme where the WordPress featured image link is not hyperlink to the post then this guide will help you to achieve that.

Featured image or the post thumbnail is a WordPress post feature. Featured images helps to display your posts beautifully in different areas of your WordPress website. At the time of publishing your WordPress pages and posts you can set a featured WordPress image with link to your posts and pages. Also, you can later change or remove featured image from a particular post or page.

WordPress Featured Image Link to Post

Advantages of Set Featured Image as Link to Post in WordPress

Generally the post title is the main link to the post. But if your post has a featured image then it will be a secondary link to reach the post. As Images are eye-catchy and interesting, your visitors will be more interested to click on those images. You will get more post visit and will help you to reduce the bounce rate on your website.

Cool Features of Featured Images:

1. It Make your post beautiful in different areas of your website.

2. Get Better engagement and click on your post.

3. Mostly used for blog posts but, you can use it on pages also.

4. Helps to reduce bounce rate on your site.


Let’s see how you can automatically Set Featured Image as Link to Post in WordPress website.

Automatically Make Featured Image Clickable WordPress

The easiest method to set your featured image as a link to your post is by applying the below code to your functions.php file.

function wpdocs_post_image_html( $html, $post_id, $post_image_id ) {
$html = '<a href="' . get_permalink( $post_id ) . '" alt="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
return $html;
add_filter( 'post_thumbnail_html', 'wpdocs_post_image_html', 10, 3 );

That’s it. You are done.

Now all your featured images and post thumbnails will automatically linked to your posts.

Note: To keep the change you made in your functions.php even after an update then, you should use a child theme.

If you have any questions about this guide on how to link featured images or thumbnails then you can mention them in the comment below.