A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
UPDATE:
I reported this problem to the author who took a bit of time but ended up fixing the problem. If you still have a problem, you probably need to upgrade to the newest version.
I just created a new website and added a few plugins, one of which is Polylang. It generally works okay. Not what I really would like to have, but close enough for a Wordpress website.
Only, it has a horrible side effect:
I destroys the canonical URL which instead of appearing as expected appears with a "%pagename%" variable in it. This is because the module caches the results of a previous call and returns that cahed value instead of recomputing it. There isn't really a way for the filter at that low level to know what version should be returned, so it ends up returning the wrong one.
To fix the problem, I went to the plugin and commented out two lines.
In the file named wp-content/plugins/polylang/include/filters-links.php
Search for a couple of lines that start with "add_filter(". In the offensive version, the original code looks like this:
if ( $this->options['force_lang'] ) { add_filter( 'post_link', array( $this, 'post_type_link' ), 20, 2 ); add_filter( '_get_page_link', array( $this, '_get_page_link' ), 20, 2 ); }
Once ommented out, it looks like this:
if ( $this->options['force_lang'] ) {
//add_filter( 'post_link', array( $this, 'post_type_link' ), 20, 2 );
//add_filter( '_get_page_link', array( $this, '_get_page_link' ), 20, 2 );
}
This obviously means the links cannot all be working quite right. But at least my canonical is showing up as expected now.
My Bug Report https://github.com/polylang/polylang/issues/149