Wordpress automatically adds the link to every image I upload within Media. And then I can’t find a way to remove it. How can I upload images without links or just remove it? There is just no option to choose whether to upload with link or without. I tried many plugins for that but none seems to be working. This happens when I use uploaded images in default Gallery widget by Wordpress. I also tried this code, but nothing. Code:
add_filter( 'the_content', 'attachment_image_link_remove_filter' );
function attachment_image_link_remove_filter( $content ) {
$content =
preg_replace(
array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
'{ wp-image-[0-9]*" /></a>}'),
array('<img','" />'),
$content
);
return $content;
}