Tagged: author archive page, Buddyblog Pro
Hi Brajesh
I am looking for a URL link that allows the current logged-in user to go to their author archive page.
I tried things like ‘www.websiteurl.com/members/me/author’ but it didn’t work.
Could you help please?
Thank you
DanielHello Daniel,
Thank you for posting. Please try ‘posts’ instead of ‘author’ and then give it a try. Please check the following screenshot
https://www.awesomescreenshot.com/image/19430895?key=0371deab9a9791ca8033264aef9b8d99
If not provided use ‘post’
Regards
RaviFor clarification, I am trying to find a URL that I can use as a custom link in the menu, to link each logged-in user to their author page.
Thanks for your help guys but I found the solution 🙂
Just incase anyone may need it in the future:
Note: Before copy pasting, don’t forget to change somePrefix with any other prefix to avoid conflict with any other shortcodes.
Step 1: Make sure you have this filter in functions.php (If not, copy paste it there)
add_filter(‘wp_nav_menu_items’, ‘do_shortcode’);
Step 2: Use this snippet to return Author URL. Paste this in functions.php
add_shortcode( ‘somePrefix_author_url’, function() {
$author_link = get_author_posts_url( get_current_user_id() ); // original link
$without_protocol = trim( str_replace( array( ‘http://’, ‘https://’ ), ”, $author_link ), ‘/’ );
return $without_protocol; // returns author link without protocol});
Step 3: Go to Navigation Menu and add Custom Menu Link and use [somePrefix_author_url] in the URL field and ‘My personal page’ or something in the Name field.
Step 4: Test the link from the front-end if it works.
The topic ‘ [Resolved] Author Archive Page’ is closed to new replies.