How to Redirect Author Link to About Page | GeneratePress

To redirect author link to about page, you can use the below PHP code snippet. To add custom PHP code to your website, you can use the popular Code Snippet plugin.

PHP Code Snippet

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

In the above snippet, replace the text “ADD_YOUR_ABOUT_PAGE_URL” with your own about page url.

Leave a Comment