[Resolved] changing author base slug

Home Forums Support [Resolved] changing author base slug

Home Forums Support changing author base slug

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2348919
    Chris

    Hi,

    I’d like to change the /author/ base slug to /journalist/

    I found the following code to do that:

    //change /author/ slug to /journalist/ 
    function new_author_base() {
        global $wp_rewrite;
        $myauthor_base = 'journalist';
        $wp_rewrite->author_base = $myauthor_base;
    }
    add_action('init', 'new_author_base');

    that seems simple enough and works on all of the author links in the bylines, bios and such.

    However, the permalink for the author pages are still site.com/author/name. I get a 404 page if I access site.com/journalist/name

    I’ve resaved permalinks and cleared caches.

    Should the code snippet have reset the permalink to /journalist/ ? If so, thoughts on why it isn’t working?

    Thanks,

    Chris

    #2348956
    Ying
    Staff
    Customer Support

    Hi Chris,

    The code looks correct, it should achieve what you are looking for.

    But the theme doesn’t handle permalinks, I don’t think there’s anything we can offer regarding this issue.

    I would suggest disabling all your plugins to test, in case there are any of them altering permalinks.

    #2349000
    Chris

    Oh, ooooh… I got it πŸ™‚

    After you confirmed it should be working… I got to thinking, what could be going wrong…

    Then I thought – I might have code snippets set to run that snippet on the front end… I wonder if… yep – switched it to working ‘everywhere’, resaved the permalink settings – and presto, now it is working as expected.

    Thanks, it was you saying it should work that got the wheels turning in my head πŸ™‚

    Chris

    #2349770
    Ying
    Staff
    Customer Support

    Awesome πŸ™‚

    Glad it’s working now!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.