Sort WordPress Archive by multiple oderby arguments in pre_get_posts action
I am not an expert, but you have a couple of issues here Firstly, is_archive() should be an object of $query. You should also just target the front end with your function. Remember, pre_get_posts alters all instances of WP_Query, front end and backend. So this line if(is_archive() && $query->is_main_query()) : should look something like this … Read more