What does query_var do in register_taxonomy

I’m not sure how to explain this in more detail, or better than it is already explained in the codex, but here is a few notes

  • IMHO, 'query_var' => true adds no proper value to your taxonomy or any other functionality relating to your taxonomy

  • As I read the docs, setting query_var to true, it makes it possible to query posts from a given term as follow

    $args = [
        '{tax}' => '{term-slug}'
    ];
    $q = new WP_Query( $args );
    

    First of all, this syntax is depreciated as of version 3.1 and is replaced with a proper tax_query which has much more advantages over the above syntax like nesting, querying posts with different relationships and including and/or excluding certain terms etc etc. The proper syntax now is

    $args = [
        'tax_query' = [
            'relation' => 'AND' // or 'OR' . RELATIONSHIP BETWEEN TWO OR MORE SETS OF TAX ARRAYS
            [
                'taxonomy' => '{tax}',
                'field' => 'CAN BE term_id TO PASS TERM IDS, slug FOR TERM SLUGS OR name FOR TERM NAMES',
                'terms' => 'TERM VALUES ACCORDING TO field SET',
                'include_children' => true OR false, // true INCLUDES ALL CHILD TERMS OF GIVEN TERM, false EXCLUDES CHILD TERMS
                'operator' => 'IN' // or 'NOT IN'. SHOULD POSTS BE IN THE GIVEN TERM OR NOT
            ],
        ],
    ];
    $q = new WP_Query( $args );
    

    Secondly are all the advantages of the tax_query syntax as you can see from the above. With version 4.1 came a complex nesting feature which let you build even more complex tax queries

  • Lastly, if setting query_var to true makes the relevant query variables available for use on taxonomy pages (I’m not even sure if it does), it is in fact still useless as the current queried object can be accessed with get_queried_object()

So to conclude, there is really no advantage setting query_var to true. It is purely personal choice if you want to waste time and space writing it out