Every time you upload an image, WordPress generates another post for that media file.
WordPress also creates multiple sizes of every image you upload according to your media settings and custom image sizes added to your child themes functions.php file.
So what does this mean?
It means your uploads folder is going to contain at least 4 sizes of every image you upload (Go to cPanel or FTP and take a look).
It also means media items (files) are also ‘Posts’ in their own right and WordPress has created a post for every media file you have uploaded.
If you want to change the default image link type from attachment page to file url or post url, here’s a few ways to get the job done.
Image Link Options When Uploading
You now have 4 options to choose from when uploading new images to posts and pages in WordPress.
Choosing the none option results in your images linking to the posts they where uploaded to which is one of the best options.
Changing Default Image Link Type
Changing your settings manually.
You can actually access your wp-options file by typing in yourdomain/wp-admin/options.php in your browser and logging into your site. This will give you access to all settings where you can find:
In the field next to this setting, you have 3 choices:
- none – This links back to the post it was uploaded to.
- file – This links to the image file in your wp-content/uploads folder. (Not recommended as may be used for hotlinking)
- post – This links back to the post it was uploaded to.
- attachment – This links to an attachment post generated by WordPress for all image files uploaded to a post.
Personally. i think its best to select post or none so your images can’t be hot linked and click thru to your content when indexed in the search engines.
Set default values for Media Uploads
Another way to fix the default image link type for single images uploaded to a post is to add this code to your child themes functions.php file.
You need to pay to fully access this tutorial.
Enjoy unlimited access & coding support by registering.
You can change instances of post to none or file depending on your own needs.
This solution only works on new images uploaded to single posts and pages.
To redirect all images from attachment pages to your post or file URL’s, install a plugin.
Redirect Image Attachment URLs to Parent Post
Another option and the last resort if you’re not already using this plugin is to install Yoast’s excellent All In One SEO plugin and use the permalink settings to Redirect attachment URL’s to parent post URL.
One of the main reasons you might want to consider redirecting your attachment posts for images back to the parent post is that they are generally low in content and could negatively effect your rankings if you allow them to be indexed.