Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics

Filtering by parent pages with Polylang

I’m facing a problem where I cannot filter by Parent page (in Pages). It’s only showing parents from English (not event first language).

I have Polylang installed with French Canadian and English Canadian.


1 week, 4 days ago
Stefan van den Dungen Gronovius

Can you tell me a bit more about the issue?
Do you mean that the drop-down list only shows items from a specific language?
Or does the actual filtering not work as intended?
It is good to know that we don’t have a specific integration for Polylang and the way they filter items based on the selected language.

1 week ago

The dropdown list only shows items for a specific language yes. Iy you’re not on that language, it’ll filter but show no result (even if the name is the same so I’m guessing it’s using the term_ID to filter.

I understand for polylang. Could it then be possible to offer all choices in the drop down? So we could use it when on See all languages?


1 week ago
Stefan van den Dungen Gronovius

The filter dropdowns get their options through an Ajax call. If you inspect the Ajax call in your browser console, you’ll see the results in JSON format on a new page. You can also use a JSON viewer extension in your browser for a clearer look at all the options.

To customize the options retrieved, we use a get_post query. According to Polylang’s documentation, you can include a ‘language’ parameter to specify the language for the query. Here’s the documentation page for reference: Polylang Developers How-To.

The Ajax call typically looks like this:

To modify the query, you can utilize the ‘pre_get_posts’ hook in WordPress. You’d trigger this hook when our Ajax call is made, checking for the specific action, like:

action = acp-filtering-comparison-request

Could you give this a try and implement the hooks based on what I’ve described? While I can guide you, writing the entire code snippet isn’t something we can provide as part of our support.

1 week ago

You must be logged in to reply to this topic.