Automattic / Automattic/jetpack
Related Posts: conflict with Polylang
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### Steps to reproduce the issue
1. Install Jetpack and activate Related Posts.
2. Install and activate the Polylang plugin.
3. Go to Languages, create a new default language, and assign all your posts to that language.
4. Create an additional language, no need to assign any posts to that one yet.
5. Visit one of your posts => Related Posts are gone.
This used to work in the past, but doesn't anymore.
The problem seems to be linked to a specific function used in Polylang to make sure Related Posts match the language used in the original post:
- https://github.com/polylang/polylang/blob/2.1.4/modules/plugins/plugins-compat.php#L46
- https://github.com/polylang/polylang/blob/2.1.4/modules/plugins/plugins-compat.php#L607-L621
Commenting this out solves the issue.
This function was added to Polylang after discussion with us, and worked at the time. See p3py7Y-C7-p2 and 2487669-t for earlier discussions about this.
cc @gibrown since you worked on the original request. Did ElasticSearch's syntax for languages change, maybe?
Related: #3280
Contributor guide
Research direction
Reproduce the issue with Jetpack Related Posts and Polylang using the listed steps, then inspect Polylang's modules/plugins/plugins-compat.php around lines 46 and 607-621 alongside the Related Posts integration. Confirm the Elasticsearch language filtering behavior and restore Related Posts for posts assigned to the default language without breaking the additional-language case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, php, wordpress
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100