4

Just wondering if there is a way to remove WordPress's default function of adding a tag around an inserted image. I assume its a "remove_filter" function like you can do for WPAutoP, but all my searches only turned up links for gallery plugins, etc.

Thanks in advance, Pete

5

This is not able to be changed through a filter. In WordPress 2.9.2 and lower, the setting can be changed in /wp-admin/options.php. The image_default_link_type field is set to "file" by default. If you set it to "none", then scroll to the bottom and save, it will disable media links.

This option has been removed from options.php in WordPress 3. For versions 3.0 and higher you need to add the following to your theme's functions.php file or write it into a plugin:

 update_option('image_default_link_type','none');

Note: Getting rid of the link affects all media. If you upload .zip, .pdf, music or other types of media that you want people to download from your site you will have to manually add links to these. There is currently an open ticket on the trac for this: http://core.trac.wordpress.org/ticket/15924

  • Not sure if something has changed but it still exist in version 3.5+ under options.php – JasonDavis May 23 '13 at 3:14
3

There's an option in the wp_options table called image_default_link_type. Changing that to "none" will prevent the default link wrapped around images.

Visit {yoursite.url}/wp-admin/options.php, find the image_default_link_type field, and change the value to "none". (Other possible values are "file" or "post".)

  • Don't ever edit core files. The changes will be lost the minute you update WordPress. – moraleida Feb 21 '13 at 23:12
  • @moraleida - I agree, but I wasn't suggesting modifying any core files. Options are publicly accessible for just this reason - so users can easily change behavior without modifying any core files... – goldenapples Feb 22 '13 at 21:25
  • Sorry about that, I completely misread your answer... – moraleida Feb 25 '13 at 15:49

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.