How to Automatically Remove Links from WordPress Images

How to Automatically Remove Links from WordPress Images

In most cases (unless your theme is set up otherwise), you will find that images in a WordPress post are automatically linked to an image file page. Some may like that. Others, however, may not.

If you happen to be one that doesn’t, then there’s a quick and simple fix to this issue. You can place the following code (found at stackexchange) in your functions.php file. (Appearance > Editor > Theme Functions – functions.php)

add_filter( 'the_content', 'attachment_image_link_remove_filter' );
function attachment_image_link_remove_filter( $content ) {
 $content =
 '{ wp-image-[0-9]*" /></a>}'),
 array('<img','" />'),
 return $content;

And that’s it.

If you would like to make your own simple plugin for this task, you can learn how to do that here.

Photo: Broken Chain from BigStock

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.