Site icon Experience Wordpress Developer Online – Design Develop and Maintenance Support

Remove anchor Links from attachment Images in WordPress

In WordPress website if you see that attachment images in a post contents are automatically linked to an image file individual page and dont want it.
then in WOrdpress a quick and simple fix for Remove anchor Links from attachment Images in WordPress. just copy paste the following code in your functions.php file. (Appearance > Editor > Theme Functions – functions.php)

add_filter( 'the_content', 'wdo_remove_attachment_image_link' );
function wdo_remove_attachment_image_link( $content ) {
	$content = preg_replace(array('{]*>}'),array(''),$content);
	return $content;
}

Other Solutions is Disable Click on Image by CSS

How to disable a link using CSS?


Exit mobile version