Why can't you modify the query in a template page?
The query can only be run inside the Loop.
You can modify the query in a template page if you use pre_get_posts().
According to WordPress best practices, the query should only be modified in functions.php.
Due to execution order, the query has already run by the time a template is loaded.
(B) You can modify the query in a template page if you use pre_get_posts().
Explanation: