I just had this issue today with one of my clients–some hacker from a foreign land was trying to access her site with her username. How did they get her username? Well, WordPress out of the box creates a nice “Author Archive” of all the posts a user has created. The URL of this author archive may contain the username to the site, rather than the nickname. Eek! How do you change your author URL in WordPress?
It's actually pretty simple, but it does involve adding code to your Child Theme's function.php file. First and for most, back up your website. This is always a good practice to do this before you make any changes to your site.
Now, go into your hosting platform, go to your file manager, dive down into your wp-contents folder, and find your theme's folder. Look for an additional folder with your theme's name and the word CHILD. If it isn't there, you can create a folder with child and the theme name. In this instance (where there wasn't a child theme), you'll need to copy the functions.php file and put the COPY in the child theme folder. You might have to rename that file from functions_copy.php back to functions.php after you put it in the child theme folder.
Why do this? Well, when your theme needs an update, and if you don't have the child theme folder, all your edits will be reverted back to the default theme. Yes, including css. Always, always, always edit in the child theme folder.
Whew! Are you whipped yet? Nope? Let's do this thing.
Edit the functions.php file in the child theme by pasting in the following code (I suggest somewhere near the bottom):
add_filter( 'author_link', 'my_author_link' );
function my_author_link() {
return home_url( 'about' );
}
If your about page is called something other than “About”, you'll need to type in your page-specific information–replacing just ‘about'. For instance if it is http://mysite.com/about-us/, you'd simply add ‘about-us' in the single quotes.
Click save. Go test that puppy out by going to your blog, clicking your Author name (Posted by Jane Doe), and see what happens. It should go to your about page.
Because I heart you hard, I made you a video doing this task.
Did you do it? Leave me a comment below!
Related Posts:
- WordPress Nicknames: How to Safe Guard Your Site
- Twelve WordPress Security Measures You Can’t Afford to Overlook