Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Hardeep Asrani

    (@hardeepasrani)

    Hey there,

    Where exactly do you want to remove the link from? Let us know.

    Hi,

    I was actually looking for a way to include “nofollow” for the links and I thought that snippet was my best clue to start…with the help of these:
    https://wordpress.org/support/topic/adding-nofollow-link-not-working/
    https://gist.github.com/spectodesign/bfc8dd42fa170dac00b9bb2f9ffad58c
    ..I was able to achieve inclusion of nofollow links on both textlink and thumbnail link:

    function alttwo_feedzy_remove_link_matches( $matches ) {
    	return '<a href="' . $matches[1] .'" rel="nofollow" target="_blank">' . $matches[2]. '</a>';
    }
    function alttwo_feedzy_remove_link( $content, $feedURL ) {
    
        $pattern= '/<a\s+href\s*=\s*"([^"]+)"[^>]*>([\d\D]+)<\/a>/iU';
        
        $content= preg_replace_callback( $pattern, 'alttwo_feedzy_remove_link_matches', $content );
        return $content;
    }
    
    add_filter( 'feedzy_global_output', 'alttwo_feedzy_remove_link', 9, 2 );

    Does it look ok?
    I have not yet updated to Feedzy 3.2.8

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“How to remove links” -snippet’ is closed to new replies.