Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Totally replace WordPress default author page URLs with that of custom taxonomy named "authors"
<?php
function disable_WP_author_rewrites($rules) {
$rules['author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?authors=$matches[1]&feed=$matches[2]';
$rules['author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?authors=$matches[1]&feed=$matches[2]';
$rules['author/([^/]+)/page/?([0-9]{1,})/?$'] = 'index.php?authors=$matches[1]&paged=$matches[2]';
$rules['author/([^/]+)/?$'] = 'index.php?authors=$matches[1]';
return $rules;
}
add_filter( 'rewrite_rules_array' , 'disable_WP_author_rewrites' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.