{"id":714,"date":"2015-12-23T18:45:08","date_gmt":"2015-12-23T13:45:08","guid":{"rendered":"http:\/\/wpbrigade.com\/?p=714"},"modified":"2026-03-02T12:13:12","modified_gmt":"2026-03-02T07:13:12","slug":"select-dropdown-countries-template-for-wordpress-developers","status":"publish","type":"post","link":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/","title":{"rendered":"Select Dropdown Countries Template for WordPress developers"},"content":{"rendered":"\n<p>Hello WordPressers,<\/p>\n\n\n\n<p>I was working on a project where I had to add the countries dropdown on the signup page. So, for making select dropdown countries selection sticky in the case of error at signup, I needed to check the <span style=\"color: #999999;\"><em>$_POST[&#8216;countries&#8217;]<\/em><\/span> with every option in the select dropdown. It seems a redundant effort to me as It took me 30 mins to do this task.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><script src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\" async=\"\"><\/script><br><!-- Single post - 1 (wpbrigade.com) --><br><ins class=\"adsbygoogle\" style=\"display: block;\" data-ad-client=\"ca-pub-1795114763684381\" data-ad-slot=\"5372388997\" data-ad-format=\"auto\"><\/ins><br><script>\/\/ <![CDATA[\n(adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n\/\/ ]]><\/script><\/p>\n\n\n\n<p>So, I am sharing this code with you people to free you from this 30 mins hassle. &nbsp;In return all I need is a &#8216;Thank you&#8217; !!!<\/p>\n\n\n\n<p>&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-select-dropdown-countries-template-for-wordpress-developers\">Select Dropdown Countries Template for WordPress developers<\/h2>\n\n\n\n<p>&nbsp;<\/p>\n\n\n\n<p><em><strong>Method: 1<\/strong><\/em><\/p>\n\n\n\n<p>This method is posted in our comments section.<\/p>\n\n\n\n<p>http:\/\/pastie.org\/10673271<\/p>\n\n\n\n<p><em><strong>Method: 2<\/strong><\/em><br><script src=\"https:\/\/gist.github.com\/hiddenpearls\/001162156c78be101d20.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello WordPressers, I was working on a project where I had to add the countries dropdown on the signup page. So, for making select dropdown countries selection sticky in the case of error at signup, I needed to check the $_POST[&lsquo;countries&rsquo;] with every option in the select dropdown. It seems a redundant effort to me [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1500,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_analytify_skip_tracking":false,"footnotes":""},"categories":[47],"tags":[117,116,118],"class_list":["post-714","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","tag-countries","tag-dropdown","tag-template"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Select Dropdown Countries Template for WordPress devs<\/title>\n<meta name=\"description\" content=\"Reducing your effort by sharing my select dropdown countries template for WordPress Projects. A small WordPress tip for you, saving your development time.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Select Dropdown Countries Template for WordPress developers\" \/>\n<meta property=\"og:description\" content=\"Reducing your effort by sharing my select dropdown countries template for WordPress Projects. A small WordPress tip for you, saving your development time.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/\" \/>\n<meta property=\"og:site_name\" content=\"WPBrigade\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/WPBrigade\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-23T13:45:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-02T07:13:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/wordpress-tips-tricks.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Adnan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wpbrigade\" \/>\n<meta name=\"twitter:site\" content=\"@wpbrigade\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Adnan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/\"},\"author\":{\"name\":\"Adnan\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/person\\\/60305aa637f786ceebbf9949f1a24634\"},\"headline\":\"Select Dropdown Countries Template for WordPress developers\",\"datePublished\":\"2015-12-23T13:45:08+00:00\",\"dateModified\":\"2026-03-02T07:13:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/\"},\"wordCount\":120,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/wordpress-tips-tricks.jpg\",\"keywords\":[\"countries\",\"dropdown\",\"template\"],\"articleSection\":[\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/\",\"name\":\"Select Dropdown Countries Template for WordPress devs\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/wordpress-tips-tricks.jpg\",\"datePublished\":\"2015-12-23T13:45:08+00:00\",\"dateModified\":\"2026-03-02T07:13:12+00:00\",\"description\":\"Reducing your effort by sharing my select dropdown countries template for WordPress Projects. A small WordPress tip for you, saving your development time.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/wordpress-tips-tricks.jpg\",\"contentUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/wordpress-tips-tricks.jpg\",\"width\":800,\"height\":400,\"caption\":\"wordpress tips and tricks, wordpress tips\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/select-dropdown-countries-template-for-wordpress-developers\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpbrigade.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Select Dropdown Countries Template for WordPress developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#website\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/\",\"name\":\"WPBrigade\",\"description\":\"WordPress Development Agency\",\"publisher\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpbrigade.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#organization\",\"name\":\"WPBrigade\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/Screen-Shot-2021-07-02-at-12.42.14-AM.png\",\"contentUrl\":\"https:\\\/\\\/wpbrigade.com\\\/wp-content\\\/uploads\\\/2021\\\/07\\\/Screen-Shot-2021-07-02-at-12.42.14-AM.png\",\"width\":271,\"height\":63,\"caption\":\"WPBrigade\"},\"image\":{\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/WPBrigade\",\"https:\\\/\\\/x.com\\\/wpbrigade\",\"https:\\\/\\\/www.instagram.com\\\/wpbrigade.agency\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpbrigade\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Wpbrigade\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wpbrigade.com\\\/#\\\/schema\\\/person\\\/60305aa637f786ceebbf9949f1a24634\",\"name\":\"Adnan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g\",\"caption\":\"Adnan\"},\"sameAs\":[\"http:\\\/\\\/adnan.pk\\\/\",\"https:\\\/\\\/x.com\\\/wpbrigade\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Select Dropdown Countries Template for WordPress devs","description":"Reducing your effort by sharing my select dropdown countries template for WordPress Projects. A small WordPress tip for you, saving your development time.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/","og_locale":"en_US","og_type":"article","og_title":"Select Dropdown Countries Template for WordPress developers","og_description":"Reducing your effort by sharing my select dropdown countries template for WordPress Projects. A small WordPress tip for you, saving your development time.","og_url":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/","og_site_name":"WPBrigade","article_publisher":"https:\/\/facebook.com\/WPBrigade","article_published_time":"2015-12-23T13:45:08+00:00","article_modified_time":"2026-03-02T07:13:12+00:00","og_image":[{"width":800,"height":400,"url":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/wordpress-tips-tricks.jpg","type":"image\/jpeg"}],"author":"Adnan","twitter_card":"summary_large_image","twitter_creator":"@wpbrigade","twitter_site":"@wpbrigade","twitter_misc":{"Written by":"Adnan","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#article","isPartOf":{"@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/"},"author":{"name":"Adnan","@id":"https:\/\/wpbrigade.com\/#\/schema\/person\/60305aa637f786ceebbf9949f1a24634"},"headline":"Select Dropdown Countries Template for WordPress developers","datePublished":"2015-12-23T13:45:08+00:00","dateModified":"2026-03-02T07:13:12+00:00","mainEntityOfPage":{"@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/"},"wordCount":120,"commentCount":4,"publisher":{"@id":"https:\/\/wpbrigade.com\/#organization"},"image":{"@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/wordpress-tips-tricks.jpg","keywords":["countries","dropdown","template"],"articleSection":["Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/","url":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/","name":"Select Dropdown Countries Template for WordPress devs","isPartOf":{"@id":"https:\/\/wpbrigade.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#primaryimage"},"image":{"@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/wordpress-tips-tricks.jpg","datePublished":"2015-12-23T13:45:08+00:00","dateModified":"2026-03-02T07:13:12+00:00","description":"Reducing your effort by sharing my select dropdown countries template for WordPress Projects. A small WordPress tip for you, saving your development time.","breadcrumb":{"@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#primaryimage","url":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/wordpress-tips-tricks.jpg","contentUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2017\/06\/wordpress-tips-tricks.jpg","width":800,"height":400,"caption":"wordpress tips and tricks, wordpress tips"},{"@type":"BreadcrumbList","@id":"https:\/\/wpbrigade.com\/select-dropdown-countries-template-for-wordpress-developers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpbrigade.com\/"},{"@type":"ListItem","position":2,"name":"Select Dropdown Countries Template for WordPress developers"}]},{"@type":"WebSite","@id":"https:\/\/wpbrigade.com\/#website","url":"https:\/\/wpbrigade.com\/","name":"WPBrigade","description":"WordPress Development Agency","publisher":{"@id":"https:\/\/wpbrigade.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpbrigade.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wpbrigade.com\/#organization","name":"WPBrigade","url":"https:\/\/wpbrigade.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpbrigade.com\/#\/schema\/logo\/image\/","url":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-02-at-12.42.14-AM.png","contentUrl":"https:\/\/wpbrigade.com\/wp-content\/uploads\/2021\/07\/Screen-Shot-2021-07-02-at-12.42.14-AM.png","width":271,"height":63,"caption":"WPBrigade"},"image":{"@id":"https:\/\/wpbrigade.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/WPBrigade","https:\/\/x.com\/wpbrigade","https:\/\/www.instagram.com\/wpbrigade.agency\/","https:\/\/www.linkedin.com\/company\/wpbrigade","https:\/\/www.youtube.com\/c\/Wpbrigade"]},{"@type":"Person","@id":"https:\/\/wpbrigade.com\/#\/schema\/person\/60305aa637f786ceebbf9949f1a24634","name":"Adnan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/db5b529a3f883d64715e1ccef9fbb1b5d602be4f9430721c997513571f1ce99f?s=96&d=retro&r=g","caption":"Adnan"},"sameAs":["http:\/\/adnan.pk\/","https:\/\/x.com\/wpbrigade"]}]}},"_links":{"self":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts\/714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/comments?post=714"}],"version-history":[{"count":2,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts\/714\/revisions"}],"predecessor-version":[{"id":319121,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/posts\/714\/revisions\/319121"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/media\/1500"}],"wp:attachment":[{"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/media?parent=714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/categories?post=714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpbrigade.com\/wpb-api\/wp\/v2\/tags?post=714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}