{"id":996,"date":"2025-03-24T14:28:14","date_gmt":"2025-03-24T14:28:14","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-to-set-business-hours-to-yes-by-default\/"},"modified":"2026-10-19T04:07:46","modified_gmt":"2026-10-19T03:07:46","slug":"how-to-set-business-hours-to-yes-by-default","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/how-to-set-business-hours-to-yes-by-default\/","title":{"rendered":"How to set business hours to YES by default"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Here is a code snippet to set GeoDirectory Business hours to &#8216;yes&#8217; in the add listing form by default<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_action( &#039;geodir_after_add_listing_form&#039;, &#039;gdsnippet_08ghhbub_maybe_toggle_business_hour&#039;);\nfunction gdsnippet_08ghhbub_maybe_toggle_business_hour() {\n    global $gd_post;\n\n    if (\n        ! empty( $gd_post ) &amp;&amp; ! empty( $gd_post-&gt;post_status ) &amp;&amp; $gd_post-&gt;post_status == &#039;auto-draft&#039;\n    ) {\n        ?&gt;\n        &lt;script&gt;\n            window.addEventListener(&#039;load&#039;, () =&gt; {\n                if ( typeof jQuery !== &#039;function&#039; ) return;\n                jQuery(&#039;#business_hours_row .fwrap-business_hours_f_active-1 #business_hours_f_active0&#039;).trigger(&#039;click&#039;);\n            });\n        &lt;\/script&gt;\n        &lt;?php\n    }\n}<\/code><\/pre>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Here is a code snippet to set GeoDirectory Business hours to &#8216;yes&#8217; in the add listing form by default<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433],"class_list":["post-996","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/996","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=996"}],"version-history":[{"count":3,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/996\/revisions"}],"predecessor-version":[{"id":2265,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/996\/revisions\/2265"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=996"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=996"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}