What to do in this case after wp_query has been modified

If the code shown above is the one the plugin is using, it will affect every query, since it’s not checking for is_main_query() (https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)

What you could do, is remove the action, do your query, and then add the action again (if needed)

remove_action( 'pre_get_posts', 'category_and_tag_archives' );
$myQuery = new WP_Query($queryArgs);
add_action( 'pre_get_posts', 'category_and_tag_archives' );

If in the plugin it has a different priority (default is 10) make sure to specify it.

Heres the remove action reference https://codex.wordpress.org/Function_Reference/remove_action

Hope this helps,

Leave a Comment