Use author author display name in permalink structure for pages and posts

I need to add the author name as a subdirectory prefix for all user’s posts and pages.

For example:

example.com/johndoe/ //The author page for John Doe
example.com/johndoe/category/test-post/ //Test post by user John Doe
example.com/johndoe/test-page/ //Test page by user John Doe

If I change the permalink structure to: /%author%/%category%/%postname%/ this works fine for displaying a user’s post but not a user’s page.

However I’m not sure if there is something I can do in .htaccess or functions.php that will allow me to get the pages to work in the same manner.

I understand this can be accomplished with Multisite, however I’m trying to avoid using this because the client doesn’t want to use it.

2 s
2

By the looks of it, there’s a plugin to achieve exactly this, so save you rolling your own for it.

The plugin is: https://wordpress.org/plugins/permalinks-customizer/

I installed it to test that it does what you’re looking for. Here’s a screenshot that shows what you’d do:

Permalinks Customizer

Leave a Comment