Display Name Author Permalink
regexp for permalink replacement (1 post)

  1. Peter Wilson
    Posted 4 years ago #

    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);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Display Name Author Permalink
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic