How to add a custom URL placeholder to author archives?

Option 1

I assume custom post type generate a URL something like this

domain.com/%custom-post-type%/%list%

So you could write it so it looks as… since the main URL doesn’t have author before custom type you would have to do this via a function since authors are dynamic

RewriteRule ^members/%author%/(.*)$ domain.com/%custom-post-type%/$1

This doesn’t specifically modify the custom post type URLs but you should be able to modify this to your need
https://gist.github.com/4336843

Option 2

or possibly if URL like this below and the custom post type doesn’t change you should be able to implement this in .htaccess and it takes the author in to account when rewriting

domain.com/members/%author%/%custom-post-type%/%list%

RewriteRule ^members/(.*)/(.*)$ domain.com/members/$1/%custom-post-type%/$2

This has a very good explanation on rewrite URL in general
http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Option 3

Also you can rewrite the entire custom post type URL if you are not using it anywhere else… because

register_post_type(); accept 'rewrite' => array ($slug)

more info

http://shibashake.com/wordpress-theme/custom-post-type-permalinks

http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2

Leave a Comment