Error message when a URL has a % sign
-
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:
https://example.com/lorem-ipsum/?highlight=search%20phrase/#comment-27
The % in the
%20
will now cause asprintf: 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)
- The topic ‘Error message when a URL has a % sign’ is closed to new replies.