Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am currently using this code:

function change_author_permalinks() {
    global $wp_rewrite;
    $wp_rewrite->author_base = 'connect/member';
}
add_action('init','change_author_permalinks');

but my current front set on my blog is:

share

So the above generates a URL like so:

http://example.com/share/connect/member/john-smith

But I don't want /share/ as part of this author URL. I cannot remove the /share/ front as it is needed for other parts of the site.

How do I set the author URL to not use front?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

This is the best solution I have come up with but I welcome better ways:

function change_author_permalinks() {
    global $wp_rewrite;
    $wp_rewrite->author_base = 'connect/member';
    $wp_rewrite->author_structure = "/" . $wp_rewrite->author_base . '/%author%';
    add_rewrite_rule('connect/member/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top');
}
add_action('init','change_author_permalinks');
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.