Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter berniegp

    (@berniegp)

    @chouby: Thanks for considering my request!

    @Both: I perused the WPML media translation docs and I really like how they handle media. If it works well, it really takes a lot of work out of managing media across languages.

    @chouby (again): do you accept contributors to your project? I haven’t seen any information regarding this on your website and all commits seem to be done by you in the history.

    Thread Starter berniegp

    (@berniegp)

    Hi!

    Thanks for answering.

    Yes, I use 1.7.2.

    Permalinks: “Post name”
    Using a static front page (not blog posts)

    Polylang options:

    s:7:"browser";i:0;
    s:7:"rewrite";i:1;
    s:12:"hide_default";i:0;
    s:10:"force_lang";i:1;
    s:13:"redirect_lang";i:0;
    s:13:"media_support";i:0;
    s:4:"sync";a:0:{}
    s:10:"post_types";a:0:{}
    s:10:"taxonomies";a:0:{}
    s:7:"domains";a:0:{}
    s:7:"version";s:5:"1.7.2";
    s:12:"default_lang";s:2:"fr";

    Using only pll_redirect_home causes requests for the front page (at wordpress root http://www.foo.com/wordpress) to be redirected (301) to http://www.foo.com/wordpress/fr/ (default language) or another language depending on the client language cookie.

    Adding the second (undocumented) filter pll_check_canonical_url makes sure requests for the wordpress root do not get redirected.

    By the way, during tests, I just noticed that Polylang doesn’t seem to respect the trashed status of a page, at least in the case of the front page. I had a trashed English translation of the front page and Polylang was redirecting to it and producing a 404.

    Thread Starter berniegp

    (@berniegp)

    This seems to do the trick. Put this code in a plugin.

    add_filter('pll_redirect_home', 'no_home_redirection');
    add_filter('pll_check_canonical_url', 'no_home_redirection_canonical', 10, 2);
    
    function no_home_redirection($redirect) {
    	return false;
    }
    
    function no_home_redirection_canonical($redirect_url, $language) {
    	if (is_front_page()) {
    		error_log('no_home_redirection_canonical');
    		return false;
    	} else {
    		return $redirect_url;
    	}
    }
Viewing 3 replies - 1 through 3 (of 3 total)