As @Milo suggested and also codex documented it is_main_query Under_the_Hood
This function is an alias for the method
WP_Query::is_main_query()
. In
filter or action hook callbacks that are passed theWP_Query
object,
such aspre_get_posts
, it is circular to call this function.
Instead, directly call the passed object’s method. For example, if
your filter callback assigns the passedWP_Query
object to$query
, you
would call the method like so:$query->is_main_query()
You must change if conduction to
function set_query_parameters($query) {
if( !is_admin() && $query->is_main_query() && is_post_type_archive( 'properties' ) ) {
$query->set('meta_key', '_featured_prop');
}
}
add_action( 'pre_get_posts', 'set_query_parameters' );
There is no need to return the query. And I really wonder why you are not receiving a NOTICE because WordPress also trigger _doing_it_wrong()
on using is_main_query()
in this way!