Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @alexinsalento ,

    I have tried code from that link and it works on my site. This is the code I used in functions.php of the theme:

    add_filter( 'hustle_render_module_markup', function( $html, $renderer, $render_id, $sub_type, $post_id ){
    
    	$doc = new \DOMDocument('1.0', 'UTF-8');
    	libxml_use_internal_errors( true );
    	$doc->loadHTML( $html );
    	libxml_use_internal_errors( false );
    	$xpath = new DOMXPath( $doc );
    	$nodes = $xpath->query( "//*[contains(@class, 'hustle-button-ct')]" );
    	foreach ( $nodes as $key =>$node ) {
    		$node->setAttribute( 'rel', 'nofollow' );
    	}
    	return $doc->saveHTML();
    }, 20, 5 );

    Can you share your code?

    kind regards,
    Kasia

    Thread Starter alexinsalento

    (@alexinsalento)

    excuse me, but work! Thankyou ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add nofollow to CTA link’ is closed to new replies.