How to disable Polylang for query
-
Hi,
I have this custom post type called status which is not translated. On the author’s archive pages I want only this custom post type to be shown. How do I disable Polylang for this query? I get no results at all since I think Polylang is trying to query the current language.
Here’s what I’ve tried.
function loop_author_archive( $query ) { if ( $query->is_author() && $query->is_main_query() && ! is_admin() ) { $query->set( 'post_type', array( 'status' ) ); } } add_action( 'pre_get_posts', 'loop_author_archive' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to disable Polylang for query’ is closed to new replies.