Recently one of our readers asked if it was possible to automatically link featured images to blog posts in WordPress.
Most WordPress themes link featured images to posts by default, but some themes may not do that.
In this article, we will show you how to automatically link featured images to posts in WordPress.
Because images are more engaging than text, using featured images can help boost user engagement on your WordPress blog.
Usually, featured images are large and take up more space than text. They are more colorful, hence more noticeable. They are also easier to click on smaller devices like mobile phones and tablets.
However, if your post thumbnails aren’t clickable, then it makes it harder for users to view your post.
Most WordPress themes link featured images to the posts by default.
But, some themes may not use that approach, which makes it difficult for you to properly utilize featured images.
Having said that, let’s see how you can 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.
You can add this code to your theme’s functions.php file. But, a better way to add custom code in WordPress is by using a code snippets plugin.
This code simply adds a link around the code generated to display featured images or post thumbnails on your website.
This code will also add a link around featured images on single post pages. If you don’t want to link featured images on a single post to the same post, then use this code.
We recommend using WPCode to add custom code in WordPress.
WPCode is the best code snippets plugin and it’s used by over 1 million websites. It makes it easy to add code snippets in WordPress without having to edit your theme’s functions.php file.
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.
Once the plugin is activated, there will be a new menu item labeled ‘Code Snippets’ in your WordPress admin bar.
Clicking on it will show you a list of the code snippets you have saved on your site. Since you’ve just installed the plugin, your list will be empty.
To add your first code snippet in WordPress, click on the ‘Add New’ button.
Next, you’ll see the Add Snippet page.
Go to the ‘Add Your Custom Code (New Snippet)’ option and click on the ‘Use snippet’ button.
After that, you need to give your code snippet a name. This can be anything to help you remember the purpose of the code.
Then, paste the snippet that you copied from above into the ‘Code Preview’ box. Don’t forget to select ‘PHP Snippet’ as the code type from the dropdown list on the right.
Next, 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.’
That’s it. Now your featured images will be automatically linked to your posts.
We hope this article helped you learn how to automatically link featured images to posts in WordPress. You may also want to see our guide on how to add captions to featured images in WordPress or our list of the best web design software.
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.