Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » WordPress / WordPress Tricks » Redirect Blog Image Page To Post Page In WordPress Without Plugin

Redirect Blog Image Page To Post Page In WordPress Without Plugin

Blogger need traffic to there post not on category page, tag page or image page. ts time to use the best use of Google Image search. Google Web search direct the user to your Web page mean post page but in WordPress there is an attachment page also where your images and videos are attached. Some time Google crawler crawl that page too and line that up in the Google result so if any user click there will be redirect to your an empty page where no text is written and the visitor will leave that.

Now as you know that WordPress is an open source CMS so you can do whatever you want. Here you can forcefully redirect the visitor that landed on your image page means attachment page to the posts page where that image was posted so through this you will get two way traffic to your posts that is good for SEO too.

Now without any more preface, here its time to directly go to the tutorial to get the steps. Then you have to follow that s steps using the below shared code that will do what we said above. After this just do the customization that you want and thats it it. So move on to do it.

Table of Contents

Recommended For You:
When You Should Migrate From Medium To WordPress CMS and How?

How To Redirect Blog Image Page To Post Page In WordPress Without Plugin?

Step 1:) Open your FTP account and navigate to .../wp-content/themes/YOUR-THEME/.
Step 2:) Here check out that is image.php file exists or not.
Step 3:) If not exists then create a file there and if exists then edit it.
Step 4.) Copy the below code and Paste it in the end of image.php file.

/* ------------------------------------------------------------------------- *
 * Redirect Blog Image Page To Post Page
/* ------------------------------------------------------------------------- */
<?php wp_redirect(get_permalink($post->post_parent)); ?>

Step 5:) Update file and done.


There is no need og any more customization.

Theme Files Editing Warning:

Keep in mind that every code that you will add in your themes files will be removed when you will change the theme. So after changing your theme, you have to follow this article again and you will get everything back same as it is now.

Last Words:

This is what we have and shared in easy steps for newbies so that they can easily know how it works. Stay with us because we are going to share a whole guide step by step about WordPress and make it easy for you. If you liked it then share it and be with us to get next tutorial. If you have any problem then feel free to ask us. We will help you with what we can or have.

Recommended For You:
4 Most Advertising Friendly WordPress Themes 

You Like It, Please Share This Recipe With Your Friends Using...

Be the first to write a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *