Support » Fixing WordPress » override wp_rewrite's $author_base for theme
4 years, 7 months ago
I found this post here talking about changing the $author_base property in the class of wp_rewrite.
I want to do the same thing, but I know it’s bad practice to edit core files.. is there a way to override this variable in my theme’s init or at runtime?
var $author_base = 'user';
Thanks in advance 🙂
Try it with this in your functions.php:
$wp_rewrite->author_base = 'user';
add_action('init', 'custom_author_base', 0 );
You have to re-save your permalink structure under Settings >Permalinks for this to work.
keesiemeijer, worked like a charm, going to be using it in a plugin i think so ill get it to flush_rewrite_rules() on plugin activation and again on deactivation to save the user having to do the permalink resaving manually 🙂