Archived topic
redirecting author archive links to about page
3 replies · Started by Todd Sindlinger on April 2, 2022
Thanks for responding, you guys - Yes, I am the only author of my website. I thought it would be nice to redirect author archive links to my about page. Do you have a code snippet I could try adding to theme's function php to handle this? I have a staging sight to give it a try. Thanks so much!
Hi there,
this is the PHP 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="https://LINK-TO-ABOUT-PAGE" 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' ) ) ),
/* 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' )
)
);
} );
In the code you will see this URL
https://LINK-TO-ABOUT-PAGE
Change that to the URL of your About page.
Thanks for all your help, David. I was successful in creating that redirect in a different way. By the way, I am very pleased with GeneratePress pro, it has everything I need! Your support forum is also awesome and greatly appreciated. Stay safe and be well...
Glad to hear that!