$_GET vs get_query_var()

get_query_var() gets variables from the main instance of WP_Query. It’s the equivalent of running global $wp_query; $wp_query->get( ‘posts_per_page’ ); It is not directly related to $_GET in any way. However, WordPress has a list of ‘public’ query variables that will be applied to the main query if they are passed as URL parameters. This is … Read more

query_vars category_name only display one catgory out of multiple categories

Inside get_posts() of WP_Query class, you will see this code block. /* * Ensure that ‘taxonomy’, ‘term’, ‘term_id’, ‘cat’, and * ‘category_name’ vars are set for backward compatibility. */ if ( ! empty( $this->tax_query->queried_terms ) ) { /* * Set ‘taxonomy’, ‘term’, and ‘term_id’ to the * first taxonomy other than ‘post_tag’ or ‘category’. */ … Read more