Archived topic
Redirect Author Archive Links
1 reply · Started by Mihail on February 19, 2023
Hello,
I want to redirect author archive links to my about page. I am the only author on my website.
I added the PHP Snippet shared in this post: https://generatepress.com/forums/topic/redirecting-author-archive-links-to-about-page/
However, it doesn't seem to work. I also changed "https://LINK-TO-ABOUT-PAGE" with a link to my about page.
https://imgur.com/5BRs16Y
What should I do to fix this?
Thank you,
Mihail.
Hi Mihail,
The snippet you added won't work in your case.
Can you try this snippet:
add_filter( 'generate_dynamic_element_url', function( $url, $link_type, $source, $block ){
if ( ! empty( $block['attrs']['className'] ) && strpos( $block['attrs']['className'], 'replace-url' ) !== false ) {
$url = 'https://google.com';
}
return $url;
},15,4);
Add replace-url to the class list of the Headline Block.
Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/
Replace https://google.com with your About page link.