WordPress Contact Form 7 Postcode plugin

Edited: 18/3/2018 with screenshots and to recognise an update.

Edited: 4/1/2019 with an update to fix filter.

Some genius at work pointed out that the contact forms on the works web site weren’t validating properly.

Whoops, my bad.

So I changed the email and telephone inputs to their proper HTML5 types, but there was the postcode box that the spammers where filling in with crap, so I wrote this little plugin for Contact Form 7 that adds postcode validation.

Once installed, it adds the Postcode option to the form builder:

Add the usual id, class and required options.

It’s free to use and abuse as you feel necessary, just a link back to the original would be nice.

Congrats to MrJoshFisher for adding placeholder support, I LOL’d and LOL’d when that came up 🙂

Extra thanks to Lacika1981 for reporting the error with the filter after a CF7 update, and more thanks to code fix supplied by Juangirini. I got around to publishing it eventually.

Download here.


  1. Hi There

    It seems to working ok, ie validating the postcode when a ‘non-postcode’ is put it and not erroring when a correct one is put in. However its preventing the form from being submitted (even with a correct postcode in) CF7 gives the problem with field error. but doesnt show any errors against the field. But I’ve pinned it down to the postcode field as if i remove it the form submits fine.

    Any thoughts why that maybe?

    1. Yeah apparently it was a CF7 update that messed it up. I’ve just got around to updating the GitHub version so it works ok now. Thanks all round, always amazed people use this 🙂

      1. Just downloaded the plugin repo and tried it and it still seems to be failing saying the postcode is not valid.

Leave a Reply