{"id":2227759,"date":"2011-08-05T18:36:10","date_gmt":"2011-08-05T18:36:10","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/retrieve-post_type-querystring-value\/"},"modified":"2016-08-20T01:50:00","modified_gmt":"2016-08-20T01:50:00","slug":"retrieve-post_type-querystring-value","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/retrieve-post_type-querystring-value\/","title":{"rendered":"Retrieve post_type querystring value?"},"content":{"rendered":"<p>I need to retrieve the post_type querystring value so that I can display the appropriate page heading on my archive page based on content type. I&#8217;ve confirmed the querystring values exist using this code from the forum:<\/p>\n<pre><code>&lt;?php\necho &quot;&lt;pre&gt;&quot;; print_r($wp_query-&gt;query_vars); echo &quot;&lt;\/pre&gt;&quot;;\n?&gt;<\/code><\/pre>\n<p>https:\/\/wordpress.org\/support\/topic\/how-to-get-query-string<\/p>\n<p>However, when I use $_GET to grab the querystring value like this:<\/p>\n<p><code>$post_type = $_GET[post_type];<\/code><\/p>\n<p>I get no value. What is the secret to capturing WordPress querystring values for this kind of task?<\/p>\n<p>Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-2227759","topic","type-topic","status-closed","hentry","topic-tag-query-string"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2227759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2227759\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=2227759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}