{"id":2387,"date":"2026-10-20T08:32:20","date_gmt":"2026-10-20T07:32:20","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/gd-categories-show-selected-categories\/"},"modified":"2026-10-20T08:41:00","modified_gmt":"2026-10-20T07:41:00","slug":"gd-categories-show-selected-categories","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-categories-show-selected-categories\/","title":{"rendered":"How to show only selected categories with gd_categories"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The GD &gt; Categories shortcode, <code>&#091;gd_categories&#093;<\/code>, can show only the categories you choose, only the categories of one post type, and sort them in your own order.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Show or hide specific categories<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>filter_ids<\/code> with a comma separated list of category IDs. A plain list shows only those categories:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_categories filter_ids=&quot;21,8,43&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A list with a minus sign before each ID shows every category except those:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_categories filter_ids=&quot;-21,-8,-43&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To find a category ID, go to Places &gt; Place Categories (the menu is named after your post type), click to edit the category, and look at the address bar. The number after <code>tag_ID=<\/code> is the ID.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Show the categories of one post type<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you have several custom post types, set <code>post_type<\/code> to the one you want:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_categories post_type=&quot;gd_place&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add <code>cpt_title=&quot;1&quot;<\/code> to show a heading such as &#8220;Place Categories&#8221; above each post type&#8217;s categories. That makes a long list much easier to read when you show categories from several post types on one page. <code>cpt_ajax=&quot;1&quot;<\/code> adds a dropdown so visitors can switch between post types.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Change the order<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>sort_by<\/code> sets the order. The choices are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>count<\/code>: most listings first (the default).<\/li>\n\n\n\n<li><code>az<\/code>: alphabetical.<\/li>\n\n\n\n<li><code>include<\/code>: the order you typed the IDs in <code>filter_ids<\/code>.<\/li>\n\n\n\n<li><code>parent<\/code>: by parent category.<\/li>\n\n\n\n<li><code>term_order<\/code>: the order saved by a category ordering plugin.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For a fixed order of your choice, list the IDs in that order and use <code>include<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&#091;gd_categories filter_ids=&quot;12,5,9,30&quot; sort_by=&quot;include&quot;&#093;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Two more options are often useful: <code>hide_empty=&quot;1&quot;<\/code> hides categories that have no listings, and <code>max_count<\/code> limits how many categories are shown per post type. All of these are also in the block and widget settings. See <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-categories\/\">GD &gt; Categories<\/a> for the rest.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The GD &gt; Categories shortcode, &#091;gd_categories&#093;, can show only the categories you choose, only the categories of one post type, and sort them in your own order. Show or hide specific categories Use filter_ids with a comma separated list of category IDs. A plain list shows only those categories: A list with a minus sign [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[213,422],"class_list":["post-2387","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-extensions-features","gd_placecategory-core-widgets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2387"}],"version-history":[{"count":2,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2387\/revisions"}],"predecessor-version":[{"id":2694,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2387\/revisions\/2694"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2387"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2387"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}