I have a custom post_type where users can vote for each post and I want to order them by voting. I can reorder the post by meta_value_num in pre_get_posts. But the problem is when I try to do that the default post gets affected. How do I prevent pre_get_posts filter WordPress default posts?
Basically, I want to know how can I check if current query is for that custom post_type.
For example, I can write conditions like the below.
if( $query->is_home() && $query->is_main_query() ){
// Code goes here
}
How can I check custom post_type?