Query_vars and custom post type wp_query
-
Do you know why if I use this url with a variable:
https://example.com/archive-tag-and-category/?post_type=my_post_type
won’t yield any result with the following code:
$cust_post_query_var = get_query_var('post_type') ; $query = new WP_Query( array('post_type' => $cust_post_query_var)) ;
whilst
$query = new WP_Query( array('post_type' => $my_post_type)) ;
works ok?
I manage to retrieve the ‘post_type’ all right but WP_Query doesn’t seem to like it…
- The topic ‘Query_vars and custom post type wp_query’ is closed to new replies.