How to Automatically Link Featured Images to Posts in WordPress

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… Read More »

The post How to Automatically Link Featured Images to Posts in WordPress appeared first on WPBeginner.

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.

Automatically link featured images to posts in WordPress

Why Link Featured Images to Posts in WordPress?

Images are more engaging than text. Using featured images can boost user engagement on your site.

Usually, featured images are large and take 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.

List25 using featured images to engage users

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. 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.

Automatically Link Featured Images to Posts in WordPress

This method required you to add code into your WordPress files. See our beginner’s guide on pasting snippets from web into WordPress.

Simply add this code to your theme’s functions.php file or a site-specific plugin.

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 );

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 single post to the same post, then use this code.

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 );

We hope this article helped you learn how to automatically link featured images to posts in WordPress. You may also want to see our list of 14 best featured image plugins and tutorials for WordPress.

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.

The post How to Automatically Link Featured Images to Posts in WordPress appeared first on WPBeginner.

How to A/B Split Test Featured Images in WordPress

Do you want to run an A/B split test for featured images in WordPress? Featured images play an important role in increasing pageviews and engaging users. A/B testing featured images can help boost your engagement. In this article, we will show you how to A/B… Read More »

The post How to A/B Split Test Featured Images in WordPress appeared first on WPBeginner.

Do you want to run an A/B split test for featured images in WordPress? Featured images play an important role in increasing pageviews and engaging users. A/B testing featured images can help boost your engagement. In this article, we will show you how to A/B test featured images in WordPress.

How to A/B Test Featured Images in WordPress

What is A/B Testing?

Featured images in WordPress posts act as the main article image. They are displayed prominently on your website and are often displayed on social media feeds when you or users share an article.

More engaging images are likely to get more clicks and will bring more users to read the article. But how do you know what kind of featured images your users find more engaging?

This is where A/B testing comes in. You display two or more variations to different audiences and track how users react. The version that gets more favorable reactions from users becomes the winner.

Site owners use A/B testing to test different landing pages on their site. See our guide on how to run A/B tests in WordPress with Google Analytics. You can also run A/B split tests for post titles in WordPress.

Having said that, Let’s see how we can run A/B tests for featured images in WordPress.

A/B Testing Featured Images in WordPress

First thing you need to do is install and activate the Featured Image Optimizer plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, simply create a new post or edit an existing one. Below the featured image meta box, you will find two new boxes named Featured Image A, and Featured Image B.

Upload two features images and activate A/B test

You need to add two different images in each featured image box by clicking on the Add featured image link. Next, under the featured image performance meta box, check the box next to ‘Activate Featured Image Plugin For this Post’ option.

Now simply publish your post and visit your website. The plugin will randomly show either one of the two images to your users.

You can see how each image performed by visiting Settings » A/B Image Settings page.

Performance page for featured images

You can also view test results by editing the post and scrolling down to Featured Image Performance meta box.

Featured image performance box on post edit screen

It will show you which image got the most clicks. This box will also have a checkbox to deactivate the A/B testing for this post.

After running the test for a while, you can select the image that performed better and set it as the main featured image for that article.

Once you have selected the winner, don’t forget to deactivate the featured image testing for that post.

That’s all, we hope this article helped you learn how to A/B test featured images in WordPress. You may also want to see our list of 14 best featured image plugins and tutorials for WordPress.

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.

The post How to A/B Split Test Featured Images in WordPress appeared first on WPBeginner.

Where Does WordPress Store Images on Your Site?

Are you wondering where does WordPress store images on your website? Many beginners users have asked us how does WordPress store images and what they can do to organize their media library more effectively. In this article, we will explain how WordPress stores images on… Read More »

The post Where Does WordPress Store Images on Your Site? appeared first on WPBeginner.

Are you wondering where does WordPress store images on your website? Many beginners users have asked us how does WordPress store images and what they can do to organize their media library more effectively. In this article, we will explain how WordPress stores images on your site.

Where does WordPress store images on your site

How Does WordPress Store Images?

WordPress comes with a built-in system to manage your media uploads like images, videos, music, documents, etc. This system allows you to upload, manage, edit, and delete files from your WordPress media library.

Media Library view in WordPress admin area

By default, WordPress stores all your images and media uploads in /wp-content/uploads/ folder on your server. All uploads are organized in a month and year based folders.

For example, all your media files uploaded in in March 2016 will be stored in:

/wp-content/uploads/2016/03/

You can view these folders by connecting to your WordPress site using an FTP client.

FTP view of uploads directory of a WordPress site

WordPress also adds information about your image uploads in the database. Information about your uploads is stored in database as a attachment post type under the posts table.

Database entry for attachment post type as seen in phpMyAdmin

WordPress also saves information in posts meta table when you insert images into posts/pages or any other custom post type.

When you set featured image also known as thumbnails, WordPress saves this information as a meta key _thumbnail_id and stores it in the postmeta table of your database.

Thumbnail ID meta key stored in postmeta table

Deleting your files from server using an FTP client will remove them from your server, but it will not remove them from the WordPress database. Those images will continue to appear on your WordPress site as broken images.

Similarly, if you delete references to your images and media uploads from database, then WordPress will stop showing them in the Media library. Even if all your images are intact and stored on your server.

Changing How WordPress Stores Images and Media Uploads

By default, WordPress does not allow you to change the uploads location from WordPress admin area. The only change you can make is to disable the month and year based folders by visiting Settings » Media page.

Organizing uploads in months and year based folders

Simply uncheck the box next to ‘Organize my uploads into month- and year-based folders’ option and save your changes. WordPress will start storing your files directly in /wp-content/uploads/ folder.

Advanced WordPress users can use a custom upload directory instead of the default location. See our guide on how to change the default media upload location in WordPress.

Organizing Your Images in WordPress

WordPress does not allow you to use custom folders when uploading your images. This makes it difficult for users to organize their images in a folder based structure.

However, you can use image tagging to organize your WordPress media uploads. WordPress gallery plugins like Envira Gallery make image organization easier with albums and image tags.

We hope this article helped you learn where does WordPress store images on your site. You may also want to see our guide on how to find royalty free images for your WordPress blog.

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.

The post Where Does WordPress Store Images on Your Site? appeared first on WPBeginner.

How to Hide Featured Images on Individual Posts in WordPress

Recently, one of our readers asked if it was possible to hide featured images on specific WordPress posts? There can be scenarios when you have a featured image for a post, but instead of removing it you may just want to hide it. In this… Read More »

The post How to Hide Featured Images on Individual Posts in WordPress appeared first on WPBeginner.

Recently, one of our readers asked if it was possible to hide featured images on specific WordPress posts? There can be scenarios when you have a featured image for a post, but instead of removing it you may just want to hide it. In this article, we will show you how to hide featured images on individual posts in WordPress.

Hiding featured image for some posts in WordPress

Why and When Hiding Featured Images in WordPress is Useful?

Featured image aka post thumbnail is a theme feature in WordPress. This means your WordPress theme controls the display of featured images on your website. See our guide on selecting the perfect theme for your WordPress site.

Cleverly used featured images on List25

Some users may be using a theme that automatically uses the first post image as featured image if no featured image was specified. This means that it will still show a featured image even if you don’t set one.

Some users may be a using a plugin to automatically set default featured image.

There are many other cases when you may come across a situation where you will have to hide a featured image.

Let’s see, how you can easily hide featured image from a WordPress post without writing any code.

Hiding Featured Image from Individual WordPress Posts

First thing you need to do is install and activate the Hide Featured Image plugin. It works out of the box, and there are no settings for you to configure.

Simply edit the post where you want to hide the featured image. On the post edit screen, scroll down a little, and you will find the ‘Show/Hide Featured Image’ metabox.

Hide featured image checkbox

You need to check the box next to ‘Hide Featured Image’ option. You can now save your post and preview it to see the plugin in action.

Notice that even though we left the featured image set in our example, the plugin did it’s job of hiding it on the website. This plugin does not delete or unset the feature image, it just hides it on the front-end of your website. If you ever want to show the featured image again, simply edit the post and uncheck the hide featured image option.

The plugin also works with custom post types with featured image support.

We hope this article helped you learn how to hide featured image from individual posts in WordPress. You may also want to check out our list of 14 best featured image plugins and tutorials for WordPress.

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.

The post How to Hide Featured Images on Individual Posts in WordPress appeared first on WPBeginner.

How to Crop and Edit WordPress Post Thumbnails

Are you frustrated with automated WordPress post thumbnail sizes which crops the image from the middle cutting off the sides? Looking for an easy solution to properly crop and scale post thumbnails? In this article, we will show you how to crop and edit WordPress… Read More »

To leave a comment please visit How to Crop and Edit WordPress Post Thumbnails on WPBeginner.

Are you frustrated with automated WordPress post thumbnail sizes which crops the image from the middle cutting off the sides? Looking for an easy solution to properly crop and scale post thumbnails? In this article, we will show you how to crop and edit WordPress post thumbnails which allows you to fix the image crop position.

A WordPress site showing a featured image on a sticky post

First thing you need to do is install and activate the Post Thumbnail Editor plugin. Upon installation, you can create a new post or edit an existing one.

Next, go to the Featured Image section and upload a new featured image or post thumbnail. You will be able to see a new link below the featured image for Post thumbnail editor.

Launch post thumbnail editor from the post editor screen

When you click on the link, it will open the featured image in the post thumbnail editor where you can crop the image size. Simply select the image sizes you want to edit from the right hand column. Take the mouse over to the image and then drag across the image to select the area you want to crop and click on the crop and save button.

Editing post thumbnail

For more settings you can click on the options button which will display additional settings. You can enter an aspect ratio to maintain during cropping. You can also rotate the image and choose a jpeg compression level.

additional options for thumbnail editor

Editing Older Thumbnails

Post Thumbnail Editor can also be used to edit any image uploaded to your WordPress site. You need to visit Media » Library and take the mouse over to any image. You will notice a link to edit thumbnails.

Editing thumbnails for old images in WordPress media library

Clicking on it will open the image in post thumbnail editor where you can crop and edit the image just like you did for the featured image on the post editing screen.

Editing thumbnails for an older image

Editing an old image will also affect the post where this image is used as featured image or post thumbnail. The newly cropped and saved size will now replace the old thumbnail.

Important: Only the image sizes you select from the right hand column will get affected by the change. Your original image will still be there, and you can still edit the image and make changes if necessary.

We hope this article helped you learn how to edit post thumbnails and featured images in WordPress without changing your theme files. You may also want to check out our tutorial on how to set a default fallback image for post thumbnails in WordPress.

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.

To leave a comment please visit How to Crop and Edit WordPress Post Thumbnails on WPBeginner.