{"id":1023,"date":"2025-03-24T14:28:17","date_gmt":"2025-03-24T14:28:17","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/change-geodirectory-random-sorting\/"},"modified":"2025-04-03T15:24:39","modified_gmt":"2025-04-03T14:24:39","slug":"change-geodirectory-random-sorting","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/change-geodirectory-random-sorting\/","title":{"rendered":"Change GeoDirectory random sorting"},"content":{"rendered":"\n<p>Random sorts reset every 24 hours to save server resources.<\/p>\n\n\n\n<p>Try the following <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippet<\/a> to refresh every hour or modify it as you like<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">function gd_snippet_rand_seed( $rand_seed ) {\n\t$minutes = 60; \/\/ SET MINUTES HERE\n\n\t$transient_name = &#039;geodir_rand_seed_custom_&#039; . $minutes;\n\t$rand_seed = get_transient( $transient_name );\n\n\t\/\/ If we don&#039;t have a transient then set a new one\n\tif ( ! $rand_seed ) {\n\t\t$rand_seed = time();\n\t\tset_transient( $transient_name , $rand_seed, (int) $minutes * MINUTE_IN_SECONDS ); \/* Updated after every x minutes *\/\n\t}\n\n\t\/\/ validate\n\t$rand_seed = absint( $rand_seed );\n\n\treturn $rand_seed;\n}\nadd_filter( &#039;geodir_rand_seed&#039;, &#039;gd_snippet_rand_seed&#039; );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Random sorts reset every 24 hours to save server resources. Try the following Code Snippet to refresh every hour or modify it as you like<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[876],"article\/categories":[211,433],"class_list":["post-1023","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-random","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/1023","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=1023"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/1023\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=1023"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=1023"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}