Apna Garage
PHP, WordPress Codes
Home
WordPress
Saturday, 20 May 2017
Remove the anchor tag surrounding images : WordPress
If you have a page of images wrapped with links. Essentially if you want to remove the links surrounding images, but keep the image tags in tact, then here is the handy code for same.
function attachment_image_link_remove_filter($content) { $content = preg_replace(array('{
]*>
}'), array('
'), $content); return $content; } add_filter('the_content', 'attachment_image_link_remove_filter');
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment