Support » Plugin: Polylang » `parse_query` filter adds language taxonomy to query

  • Hello,

    Polylang plugin version: 2.3.10
    WordLift plugin version: 3.19.4
    WordPress version: 4.9.8

    Your plugin adds a filter to parse_query in the frontend.php file:

    add_action( 'parse_query', array( $this, 'parse_query' ), 6 );

    The callback is adding a taxonomy filter for the language taxonomy even though some of the queried post types aren’t configured for translation ( in the query args: 'post_type' => array( 'post', 'page', 'entity', where entity isn’t translatable). Your filter is breaking the query because entities aren’t returned anymore, since they’re not bound to the language taxonomy.

    I don’t think the Polylang plugin should add a requirement for the language taxonomy when the query involves post types that aren’t configured for translation.

    Can you please fix it?

    PS: I am available if you need further details.

    Cheers,
    David

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Chouby

    (@chouby)

    Hi,

    Unfortunately there is no way in WordPress to write one query with a tax query applied to only some post types and not the other.

    In most cases, the users want their translatable post types to be filtered by language. If I stopped filtering queries mixing translatable and untranslatable post types, then the results would mix all languages for posts and pages. This is maybe what you want, not what most people want.

    If you want to stop the filter, just add 'lang' => '' to your query.

    This is now happening again with Polylang 2.5. Has something changed?

    We solved it by adding 'lang' => '' to another query.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘`parse_query` filter adds language taxonomy to query’ is closed to new replies.