Is there a way to disable image or thumbnail link URL, as well as remove existing image/thumbnail links in functions.php?

NOT the setting under media as posted in this link, please.

  • i don`t understand the question ). Could you provide more details..
    – Alexey
    Oct 5, 2011 at 11:54
  • if you look at the link, perhaps you can understand better
    – Sean Lee
    Oct 5, 2011 at 16:29

5 Answers 5


A little late to this party but it seems the OP wants to (1) prevent these WP Selfies from recurring and (2) remove existing WP Selfies.

Here is a great filter to prevent it from happening in the future: http://andrewnorcross.com/tutorials/stop-hyperlinking-images/.

And I just posted a snippet that removes existing self linking images here: http://cfxdesign.com/remove-existing-self-linking-images-in-wordpress/.

  • Did you try the snippet from your second link on the latest wordpress?
    – Sean Lee
    Dec 19, 2014 at 6:41
  • You asked for it and there's the answer. If you tried it in the latest WordPress and encountered some issues then feel free to post a more substantive comment here or on the blog ;-)
    – cfx
    Dec 21, 2014 at 3:37

I know there is some confusion about your question, but if I understand it correctly it seems like it might be a duplicate of Disable image attachment links which I just answered with a note about a plugin that solves the functionality of removing links for images.

The plugin is called "Remove Link URL" and it removes the link by default, still allowing it to be added in if you click the button.

screenshot-1.png?r=494378 http://img208.imageshack.us/img208/56/screenshot1vk.png

I believe this fixes the problem you're describing :)

  • This is exactly the link that I included in the original post as NOT THE ONE. Thanks anyway.
    – Sean Lee
    Feb 10, 2012 at 0:42
  • perhaps if you spent a little time better explaining the desired behavior people could give you better answers to your question.
    – cwd
    Feb 11, 2012 at 14:54
  • As said above, I need to disable thumbnail the links on any images or thumbnails inserted into the post using the media manager, not individually like you posted (which is exactly the link I provided above as I marked not that one). This means, disable must be done in functions.php like a filter for any images inserted via media manager. Then also a filter that can remove any existing links inserted via the media manager, which may not be easy to differentiate if using preg_match of the img url. Hopefully you get the picture.
    – Sean Lee
    Feb 22, 2012 at 11:26
if ( has_post_thumbnail() ) {
    return "<div class='post-thumbnail'><a href='" . $featured_image_link . "'>" . $featured_image . "</a></div>";

Open function.php file and delete

<a href='" . $featured_image_link . "'>" . $featured_image . "</a> 

from code


If i understand right. You are looking for something like this. Key word is attachment_fields_to_edit

  • not exactly it, but this may be good for restricting attachment editor interface. What I need is to remove the attachment links already in the post using functions.php.
    – Sean Lee
    Oct 6, 2011 at 2:25
  • From existing post? I still don't understand want you want. Tell us full story!
    – Alexey
    Oct 6, 2011 at 10:51
  • anyone uploading images, if setting was not previously unset for auto-embed, and one did not knowingly check "none" for Link URL, then a link will be generated for each image inserted into post.
    – Sean Lee
    Oct 6, 2011 at 18:49
  • You describe default behaviour of image insertion.
    – Alexey
    Oct 6, 2011 at 19:26
  • well, you asked for full story, that's what caused it. There's the link, and that needs to be removed. What you provided and what the link in my original post only covers prior, not after.
    – Sean Lee
    Oct 6, 2011 at 19:28

There is a feature

Goto Settings->Media->Auto-embeds->Uncheck the box

according to link you post and i checked it out its working but maybe not found in all versions I'm using 3.2.1

  • I've notated above, NOT the setting.
    – Sean Lee
    Oct 5, 2011 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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