i have this site with only one image in each post.. how do you turn the posted image to hyperlink to the permalink? Most images are from an external source and is just automatically embedded on each post using a plugin that I use. There are a lot of posts on my site already and it's next to impossible to manually edit each post to link the each image to the post's permalink..

I checked the index.php of my site.. I saw a line for "the content" and when I added an "a href" to it linking to the permalink, it just doesn't work, im not sure why..

please help. thanks!

  • You should add the images as featured images, if your theme supports post thumbnails – shea Dec 22 '12 at 3:49
  • thanks for replying! im not really sure how to do that.. when i check each post, there is a feature image option at the bottom right. by the way, these images are from an external source just embedded on the post. – Jake Dec 22 '12 at 4:49

If they are featured images or post Thumbnails U can add this code in functions.php to link them

add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );

function my_post_image_html( $html, $post_id, $post_image_id ) {

$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr(   get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
 return $html;


If U need to add theme support then refer to this link


Or else if U don't prefer to add this code just find files like

Loop.php , content.php,-main.php,index.php, home.php

And then just press F3 in this files and search for


And Permalink that code

And if U don't find that then it may possible that ur themeay using tbe_content for it

  • this is syntax on the index.php file... <div class="blog_content"> <? the_content() ?> </div> i tried to change it to <div class="blog_content"><A href="<? the_permalink();?>"><? the_content() ?></A> but doesn't seem to work.. – Jake Dec 22 '12 at 5:26
  • Are U only using post thumbnails if yes then replace <? The_content ?> with <?PHP the_post_thumbnail('large'); ?> and then Permalink them – vaibhav Dec 22 '12 at 5:39
  • Let me know if it works – vaibhav Dec 22 '12 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.