How to perform a WP_Query with current language?
-
I was expecting that this was asked before, but I couldn’t find any support requests regarding this (probably worth mentioning in your FAQ).
I have a function in which I’m performing a
WP_Queryto list all events. Events are apost_typeused by a event plugin. This is what the query looks like:$args = array( 'post_type' => 'event', 'lang' => pll_current_language(), 'showposts' => $amount, // 'category_name' => $slug, 'post__not_in' => get_option( 'sticky_posts' ) ); $query = new WP_Query( $args );However, this does not respect the current language and lists all the events, ultimately appearing like duplicates. What am I doing wrong?
Edit: I’m using a static frontpage
The topic ‘How to perform a WP_Query with current language?’ is closed to new replies.