• Resolved haxxxton

    (@haxxxton)


    Hey guys,

    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?

    i.e. to:

    var $author_base = 'user';

    Thanks in advance ??

    haxxxton

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with this in your functions.php:

    function custom_author_base(){
    global $wp_rewrite;
    $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.

    Thread Starter haxxxton

    (@haxxxton)

    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 ??

    appreciate it

    Thread Starter haxxxton

    (@haxxxton)

    resolved

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘override wp_rewrite's $author_base for theme’ is closed to new replies.