• I needed to remove links from around the thumbnails: img_1img_2img_3 etc.. (From remove links from images using functions.php) This has worked well for me.

    function attachment_image_link_remove_filter( $html, $item, $images ) {
        $html =
            preg_replace(
                array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                    '{ wp-image-[0-9]*" /></a>}'),
                array('<img','" />'),
                $html
            );
        return $html;
    }
    add_filter( 'wplister_process_template_html', 'attachment_image_link_remove_filter' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support WP Lab Support

    (@wp-lab-support)

    Hello stevehoo.

    I am happy to assist you today.

    But I’m not sure what you are asking. I think you are sharing what worked for you. Either way, we can drop the extra 2 parameters ($item and $images), as those are unnecessary.

    function attachment_image_link_remove_filter( $html ) {
        $html =
            preg_replace(
                array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                    '{ wp-image-[0-9]*" /></a>}'),
                array('<img','" />'),
                $html
            );
        return $html;
    }
    add_filter( 'wplister_process_template_html', 'attachment_image_link_remove_filter' );

    Kind regards,
    John

    Thread Starter stevehoo

    (@stevehoo)

    Ah, sorry, I wasn’t asking anything, just saying what had worked for me, adding to the footsteps in the snow.
    Loving the plugin.
    Steve

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to: remove anchors from around attached images’ is closed to new replies.