Skip to content

Instantly share code, notes, and snippets.

@aendra-rininsland
Created August 21, 2015 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aendra-rininsland/cfd211ec43e859063546 to your computer and use it in GitHub Desktop.
Save aendra-rininsland/cfd211ec43e859063546 to your computer and use it in GitHub Desktop.
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