PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

UK Specific Address - HELP!

  1. sxmungall

    Hi! Which files do I need to modify in the plugin editor to change the Canada specific info to UK? All I need to change is the word province to "county" and the drop down list. And also the length of the Postal Code characters. Many thanks in advance.

    P.S. Are there any plans to add the UK to the country specific list in future?

    Posted 10 years ago on Wednesday December 23, 2009 | Permalink
  2. There isn't a UK specific address format. There is a U.S. and Canada specific address format. For the UK you will need to use the International address format.

    The International address format should accept longer postal codes and instead of a an actual drop down for state or province it has a State/Province/Region text field.

    We are considering adding a UK address format in the future.

    One thing you can do is use an available API hook to change the "State/Province/Region" sub-label text to whatever you want (in this case i'm assuming County). Here is some information on that:

    The hook you would use to change the address labels is a filter. Here it is:

    add_filter("gform_address_state", "set_gravityform_state");
    function set_gravityform_state($label){
        return "County";

    The example above would change the state label of the address field for *ALL* your forms. If you want to target a specific form you would append the form id to the filter call from gform_address_state to gform_address_state_ID with ID being the form id of the form you want to customize. For example:

    add_filter("gform_address_state_5", "set_gravityform_state");
    function set_gravityform_state($label){
        return "County";

    You would place this code in your themes functions.php file.

    The available filter names for changing labels are:


    The one you would like to filter on in this situation would be gform_address_state

    Posted 10 years ago on Wednesday December 23, 2009 | Permalink
  3. sxmungall

    Thanks for getting back to me. I actually went ahead and changed the common.php file by inserting the following code where the Canada provinces had originally been.

    public static function get_canadian_provinces(){
            return array(__("Aberdeen City","gravityforms"),__("Aberdeenshire","gravityforms"),__("Angus","gravityforms"),__("Argyll and Bute","gravityforms"),__("Avon","gravityforms"),__("Bedfordshire","gravityforms"),__("Berkshire","gravityforms"),__("Blaenau Gwent","gravityforms"),__("Borders","gravityforms"),__("Bridgend","gravityforms"),__("Bristol","gravityforms"),__("Buckinghamshire","gravityforms"),__("Caerphilly","gravityforms"),__("Cambridgeshire","gravityforms"),__("Cardiff","gravityforms"),__("Carmarthenshire","gravityforms"),__("Ceredigion","gravityforms"),__("Cheshire","gravityforms"),__("Clackmannan","gravityforms"),__("Cleveland","gravityforms"),__("Conwy","gravityforms"),__("Cornwall","gravityforms"),__("Cumbria","gravityforms"),__("Denbighshire","gravityforms"),__("Derbyshire","gravityforms"),__("Devon","gravityforms"),__("Dorset","gravityforms"),__("Dumfries and Galloway","gravityforms"),__("Durham","gravityforms"),__("East Ayrshire","gravityforms"),__("East Dunbartonshire","gravityforms"),__("East Lothian","gravityforms"),__("East Renfrewshire","gravityforms"),__("East Riding of Yorkshire","gravityforms"),__("East Sussex","gravityforms"),__("Edinburgh City","gravityforms"),__("Essex","gravityforms"),__("Falkirk","gravityforms"),__("Fife","gravityforms"),__("Flintshire","gravityforms"),__("Glasgow","gravityforms"),__("Gloucestershire","gravityforms"),__("Greater Manchester","gravityforms"),__("Gwynedd","gravityforms"),__("Hampshire","gravityforms"),__("Herefordshire","gravityforms"),__("Hertfordshire","gravityforms"),__("Highland","gravityforms"),__("Humberside","gravityforms"),__("Inverclyde","gravityforms"),__("Isle of Anglesey","gravityforms"),__("Isle of Wight","gravityforms"),__("Isles of Scilly","gravityforms"),__("Kent","gravityforms"),__("Lancashire","gravityforms"),__("Leicestershire","gravityforms"),__("Lincolnshire","gravityforms"),__("London","gravityforms"),__("Merseyside","gravityforms"),__("Merthyr Tydfil","gravityforms"),__("Middlesex","gravityforms"),__("Midlothian","gravityforms"),__("Monmouthshire","gravityforms"),__("Moray","gravityforms"),__("Neath Port Talbot","gravityforms"),__("Newport","gravityforms"),__("Norfolk","gravityforms"),__("North Ayrshire","gravityforms"),__("North Lanarkshire","gravityforms"),__("North Yorkshire","gravityforms"),__("Northamptonshire","gravityforms"),__("Northumberland","gravityforms"),__("Nottinghamshire","gravityforms"),__("Orkney","gravityforms"),__("Oxfordshire","gravityforms"),__("Pembrokeshire","gravityforms"),__("Perthshire and Kinross","gravityforms"),__("Powys","gravityforms"),__("Renfrewshire","gravityforms"),__("Rhondda Cynon Taff","gravityforms"),__("Roxburghshire","gravityforms"),__("Rutland","gravityforms"),__("Shetland","gravityforms"),__("Shropshire","gravityforms"),__("Somerset","gravityforms"),__("South Ayrshire","gravityforms"),__("South Lanarkshire","gravityforms"),__("South Yorkshire","gravityforms"),__("Staffordshire","gravityforms"),__("Stirling","gravityforms"),__("Suffolk","gravityforms"),__("Surrey","gravityforms"),__("Swansea","gravityforms"),__("The Vale of Glamorgan","gravityforms"),__("Torfaen","gravityforms"),__("Tyne and Wear","gravityforms"),__("Warwickshire","gravityforms"),__("West Dunbartonshire","gravityforms"),__("West Lothian","gravityforms"),__("West Midlands","gravityforms"),__("West Sussex","gravityforms"),__("West Yorkshire","gravityforms"),__("Western Isles","gravityforms"),__("Wiltshire","gravityforms"),__("Worcestershire","gravityforms"),__("Wrexham","gravityforms"));

    It seems to work fine in the preview mode. But do you think I'm likely to encounter any problems using my method as opposed to the one you mentioned?

    Posted 10 years ago on Thursday December 24, 2009 | Permalink
  4. Yes, the issue is when we release an update to Gravity Forms you will need to re-apply these changes. This is perfectly fine as long as you remember that when you upgrade Gravity Forms as we release new versions... that you will need to apply your changes again.

    We highly recommend keeping up to date with the latest version of Gravity Forms. Just like keeping up to date with WordPress, it is important for security and bug related issues... not to mention new features we introduce... that you stay up to date.

    Posted 10 years ago on Thursday December 24, 2009 | Permalink
  5. sxmungall

    Thanks Carl. I'll bare that in mind. Hopefully, the UK data will be provided in your upcoming releases. Keep up the great work.

    Posted 10 years ago on Thursday December 24, 2009 | Permalink
  6. I will look into having the UK data added in a future release. Thanks!

    Posted 10 years ago on Friday December 25, 2009 | Permalink
  7. Any update as yet about when UK customers can expect to see "State/Province/Region" renamed as "County" and "Zip / Postal Code" amended to "Postcode"?

    Posted 9 years ago on Tuesday August 24, 2010 | Permalink
  8. @millionblade This can already be done using filters and some custom code snippet you add to your themes functions.php file to rename those labels. We've implemented the ability to add your own address type in the 1.4 beta, but it utilizes hooks so you do it with code. We can't account for every use case when it comes to addresses as their are too many variations.

    Posted 9 years ago on Wednesday August 25, 2010 | Permalink
  9. Many thanks for the prompt response. I look forward to 1.4 when it passes beta.

    Posted 9 years ago on Wednesday August 25, 2010 | Permalink
  10. New user here (Developer license).
    I'm attempting to install this on German websites.
    From what I can tell I'm going to have to do alot of template editing that won't be carried across with future updates.... worried :-/

    Posted 9 years ago on Tuesday June 7, 2011 | Permalink
  11. Hi guys,

    This thread has been a big help as I need to make two changes to the labels to make them more Australia specific.

    I've been able to change either the state label or the zip label but not both due to my limited PHP skills.

    So in functions.php I added:

    That worked, so then I added another one:

    But now I get a PHP Error:

    Can someone point me in the right direction in terms of the PHP I need to get both labels changed?

    Posted 8 years ago on Saturday September 17, 2011 | Permalink
  12. You have used the function name set_gravityform_state twice in functions.php, once on line 96, once on line 103. Change the name of one of the functions to make it different. You can't use the function name twice like that.

    Try this naming.

    Line 96

    Line 103

    That should take care of it. You can name your functions whatever you want (within limits) so long as they are unique.

    Posted 8 years ago on Saturday September 17, 2011 | Permalink
  13. Lovely stuff thanks so much, worked brilliantly.

    Posted 8 years ago on Sunday September 18, 2011 | Permalink
  14. Glad you worked that out. Cheers!

    Posted 8 years ago on Sunday September 18, 2011 | Permalink

This topic has been resolved and has been closed to new replies.