Title: zip code / code postal
Last modified: May 5, 2021

---

# zip code / code postal

 *  Resolved [plykite](https://wordpress.org/support/users/plykite/)
 * (@plykite)
 * [5 years ago](https://wordpress.org/support/topic/zip-code-code-postal/)
 * Hello,
    How can i do to input only 5 numbers in the zip code field ? (i did this
   field using adress the field with select only zip code) Comment faire pour ne
   pouvoir saisir que 5 chiffres dans la zone code postal ? (jel’ai fait en utilisant
   le chanp de type adresse en ne sélectionnant que le code postal)
 * Merci
 * Pascal
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fzip-code-code-postal%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [5 years ago](https://wordpress.org/support/topic/zip-code-code-postal/#post-14403225)
 * Hi [@plykite](https://wordpress.org/support/users/plykite/)
 * It’s not possible out of the box but can be done with a bit of custom code. You
   can add this code to the site as “MU Plugin”:
 * – create an empty file with .php extension (e.g. forminator-limit-zip-code.php)
   –
   copy and paste this code into it
 *     ```
       <?php
       /**
       * Plugin Name: [Forminator Pro] WPMU DEV Customization.
       * Description: Limits Forminator Text field under max length 5
       * Author: @ WPMUDEV
       * Author URI: https://premium.wpmudev.org/
       */
       add_action('wp_footer', 'custom_length_snippet');
       function custom_length_snippet() {?>
       	<script>
           	document.querySelector('#forminator-field-text-2').setAttribute("maxlength", 5)
       </script>
       <?php}
       ```
   
 * Mote: In this line you’ll have to adjust the field ID
 * `document.querySelector('#forminator-field-text-2').setAttribute("maxlength",
   5)`
 * – save the file and upload it to the “/wp-content/mu-plugins” folder of your 
   WordPress installation; if there’s no “mu-plugins” folder right inside “wp-content”
   yet, just create an empty one first.
 * It should work out of the box if field ID matches the field on the form, though
   you may need to clear cache on your site/server first.
 * Best regards,
    Adam

Viewing 1 replies (of 1 total)

The topic ‘zip code / code postal’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [zip code](https://wordpress.org/support/topic-tag/zip-code/)

 * 1 reply
 * 2 participants
 * Last reply from: [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/zip-code-code-postal/#post-14403225)
 * Status: resolved