{"id":2680,"date":"2026-10-20T08:35:26","date_gmt":"2026-10-20T07:35:26","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/add-listing-form-default-category-privacy-checkbox\/"},"modified":"2026-10-20T08:40:41","modified_gmt":"2026-10-20T07:40:41","slug":"add-listing-form-default-category-privacy-checkbox","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/add-listing-form-default-category-privacy-checkbox\/","title":{"rendered":"How to hide the default category field and add a privacy checkbox to the add listing form"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Both are done in the post type&#8217;s custom fields in GeoDirectory. To make the checkbox text link to your privacy policy you also need a short snippet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hide the Default Category field<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Default Category select only appears on the add listing form when the Category field lets users choose more than one category. GeoDirectory uses it to decide which category goes in the listing URL and sets the map marker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To remove it, go to Places &gt; Settings &gt; Custom Fields, open the Category field and set Category display type to Select or Radio. Users then pick one category, and that one becomes the default. With Multiselect or Checkbox the field stays, because GeoDirectory needs to know which of the chosen categories is the main one. See <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/what-is-the-default-category-field-for\/\">What is the Default Category Field for?<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add a privacy policy checkbox<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to Places &gt; Settings &gt; Custom Fields.<\/li>\n\n\n\n<li>Under Standard Fields, click Checkbox.<\/li>\n\n\n\n<li>Enter a Label such as Privacy policy, the Key <code>privacy_policy<\/code>, and a Description such as &#8220;I accept the privacy policy&#8221;.<\/li>\n\n\n\n<li>Tick Is required and fill in Required message.<\/li>\n\n\n\n<li>Save the field, then drag it in the field list so it sits next to Terms &amp; Conditions.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The predefined Terms &amp; Conditions field links its text to the page set at GeoDirectory &gt; Settings &gt; General &gt; Pages &gt; Terms and Conditions page. A normal checkbox field has no link option, and HTML typed into its Description is shown as plain text.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This snippet turns the Description of the <code>privacy_policy<\/code> field into a link to the privacy policy page selected at Settings &gt; Privacy in WordPress. Add it with the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets plugin<\/a> or your child theme&#8217;s functions.php:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;geodir_custom_field_input_checkbox&#039;, &#039;my_gd_privacy_checkbox_link&#039;, 20, 2 );\nfunction my_gd_privacy_checkbox_link( $html, $cf ) {\n\t\/\/ Only change the field with the key privacy_policy.\n\tif ( empty( $cf&#091;&#039;htmlvar_name&#039;&#093; ) || $cf&#091;&#039;htmlvar_name&#039;&#093; !== &#039;privacy_policy&#039; || empty( $cf&#091;&#039;desc&#039;&#093; ) ) {\n\t\treturn $html;\n\t}\n\n\t$privacy_url = get_privacy_policy_url();\n\tif ( ! $privacy_url ) {\n\t\treturn $html;\n\t}\n\n\t$text = __( $cf&#091;&#039;desc&#039;&#093;, &#039;geodirectory&#039; );\n\t$link = &#039;&lt;a href=&quot;&#039; . esc_url( $privacy_url ) . &#039;&quot; target=&quot;_blank&quot;&gt;&#039; . esc_html( $text ) . &#039;&lt;\/a&gt;&#039;;\n\n\treturn str_replace( $text, $link, $html );\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you used a different key for the field, change <code>privacy_policy<\/code> in the snippet to match. Keep the Description to plain words, without quotes or other special characters, so the snippet can find it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Both are done in the post type&#8217;s custom fields in GeoDirectory. To make the checkbox text link to your privacy policy you also need a short snippet. Hide the Default Category field The Default Category select only appears on the add listing form when the Category field lets users choose more than one category. GeoDirectory [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[432,211],"class_list":["post-2680","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-how-tos","gd_placecategory-tips-tricks-more"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2680","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=2680"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2680\/revisions"}],"predecessor-version":[{"id":2823,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2680\/revisions\/2823"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2680"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2680"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}