Happy Halloween! Get 20% off GP Premium with the discount code: HALLOWEEN20

[Resolved] Nofollow author link

Home Forums Support Nofollow author link

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #919611
    Manu

    Hello

    Is it possible to nofollow author name link with a function?

    Thanks!

    #919716
    Leo
    Staff
    Customer Support

    Hi there,

    Try this PHP snippet:

    add_filter( 'generate_post_author_output', function() {
        printf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="author vcard" %5$s>%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="nofollow" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
    		__( 'by', 'generatepress' ),
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		/* translators: 1: Author name */
    		esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
    		esc_html( get_the_author() ),
    		generate_get_microdata( 'post-author' )
    	)
        );
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Let me know 🙂

    #919727
    Manu

    I’m sorry, it works correctly. I had checked it wrong: D

    Thank you very much for the quick help!

    #919733
    Leo
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.