Update image links from "link" to "file"
-
Hello!
I want to update all image links in articles. Currently they are linked to their attachment pages, I want to link them directly to the file to use a lightbox-style plugin.I found this code. It sets image links to “none” – that is nearly what I want, I want them to be set to “file” – is that possible?
This is the “remove”-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; }
Thank you very much for your answer!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Update image links from "link" to "file"’ is closed to new replies.