Support » Plugin: Better Recent Comments » Error message when a URL has a % sign

  • Resolved Mikko Saari

    (@msaari)


    Better Recent Comments causes an error message when the link URL features a % sign. That’s a rare occasion, as URLs generally don’t have % signs, but it can happen when using Better Recent Comments with Relevanssi, you may have a URL like this: http://example.com/lorem-ipsum/?highlight=search%20phrase/#comment-27

    The % in the %20 will now cause a sprintf: too few arguments error.

    The solution is to edit line 112 in /includes/class-better-recent-comments-util.php and escape the % signs like this:

    $link_fmt = '<a href="' . str_replace( '%', '%%', esc_url( get_comment_link( $comment->comment_ID ) ) ) . '">%s</a>';

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