Problems with WordPress Like Plugin and Polylang

Sometimes, drugs interact with each other, and the same happens to WordPress Plugins. The following example demonstrates one of such interactions.

Both Polylang and Facebook Like plugins work completely as expected on themselves, however, when used together somethings get broken.

Facebook Like plugin does somewhat what it’s name implies: add the facebook button to your wordpress blog. It’s also possible to share the page directly to facebook. Both features work flawlessly on its own.

Polylang it’s one of most useful plugins you can find if you need to post stuff on two or more languages. It checks the configured language on the browser, with the language set for each post, and displays the post accordingly. Simple and it works.

However, when when using a translated post with facebook like, things brake down. Facebook uses a script to check access to the shared pages and try to identify eventual images to show them on Facebook, this is known as facebookexternalhit (useragent facebookexternalhit/1.0). Now, this script does not sets the language, or it sets the language wrong, Polylang has not means to set the correct version. All this results that when people tries to share a page directly on the blog, sometimes the error “The page _some_URL_ cannot be reached.” is returned.

After some digging, where’s the workaround for sharing the page on Facebook itself, but does not fixes the share page on the blog, but the share feature on Facebook itself: while sharing the page including the post ID, add the desired language, eg:


Sharing won’t work and will return error.


Note that the language is explicitly added.

There may be other solutions to the problem (including changing the way that polylang sets the post URL) but those incur on other problems.