Support » Plugin: Display Name Author Permalink » [Plugin: Display Name Author Permalink] regexp for permalink replacement

  • Line 56 of the plugin uses str_replace to generate the permalink, where a regular expression would be a better fit.

    Consider a blog on example.com with an author login of exam and the display name of exam ple.

    Using str_replace to generate the link changes the permalink from example.com/author/exam/ to exam-pleple.com/author/exam-ple/

    Replacing line 56 with the code below fixes this problem

    $patten = '/\/' . $author_nicename . '\/$/';
    $replacement = '/' . $this->users[$author_nicename] . '/';
    $link = preg_replace($patten,$replacement, $link);
  • The topic ‘[Plugin: Display Name Author Permalink] regexp for permalink replacement’ is closed to new replies.