[Plugin: Polylang] Wrong redirect after posting a comment
-
When I post a comment at article /en/article/#comment-1, comment is saved and I am redirected to /article/#comment-1, what is 404.
I’ve made a small workaround in polylang.php and it’s now working for me:
# in function __construct() add_filter('get_comment_link', array(&$this, 'pl_get_comment_link'), 10, 2);
function pl_get_comment_link($val, $args) { global $polylang; $post_id = $args->comment_post_ID; $lang = $polylang->get_post_language($post_id); $lang_slug = $lang->slug; $url = preg_replace("#^(.+://[^/]+)/(.+)$#", "$1/".$lang_slug."/$2", $val); return $url; }
But it is not a complex solution, because it’s only working with rewrites.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: Polylang] Wrong redirect after posting a comment’ is closed to new replies.