• 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)
  • Plugin Author Chouby

    (@chouby)

    Thank you for the bug report. I repoduce the wrong redirection when adding the language code to all urls, although I don’t get a 404 error as the url of the post without the language code should be valid. I will correct the bug in 0.8.4, although I will use a different solution from yours.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Polylang] Wrong redirect after posting a comment’ is closed to new replies.