Title: Advanced Custom Fields: Validated Field
Author: doublesharp
Published: <strong>Gwengolo 27, 2012</strong>
Last modified: Eost 19, 2015

---

Search plugins

![](https://ps.w.org/validated-field-for-acf/assets/banner-772x250.png?rev=1119508)

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/validated-field-for-acf/assets/icon-256x256.png?rev=1116693)

# Advanced Custom Fields: Validated Field

 By [doublesharp](https://profiles.wordpress.org/doublesharp/)

[Download](https://downloads.wordpress.org/plugin/validated-field-for-acf.1.7.7.zip)

 * [Details](https://bre.wordpress.org/plugins/validated-field-for-acf/#description)
 * [Reviews](https://bre.wordpress.org/plugins/validated-field-for-acf/#reviews)
 *  [Installation](https://bre.wordpress.org/plugins/validated-field-for-acf/#installation)
 * [Development](https://bre.wordpress.org/plugins/validated-field-for-acf/#developers)

 [Support](https://wordpress.org/support/plugin/validated-field-for-acf/)

## Description

#### Validated Field Add-On

The **Validated Field** add-on for [Advanced Custom Fields](https://wordpress.org/extend/plugins/advanced-custom-fields/)

provides a wrapper for other input types which allows you to provide client side
input masking using the jQuery [Masked Input Plugin](http://digitalbush.com/projects/masked-input-plugin/),
server side validation using either PHP regular expressions or PHP code, the option
of ensuring a field’s uniqueness for all posts by `post_type` and `meta_key`, `post_type`,
or site wide, or a single post by meta_key, as well as marking a field as read-only.
Edit your fields in the ACF Field Group editor and update code using the ACE.js 
IDE with autocomplete and syntax validation.

#### Features

 1. **Input Masking** – easily set masks on text inputs to ensure data is properly 
    formatted.
 2. **Server-Side Validation** – validate the inputs using server side PHP code or 
    regular expressions.
 3. **Uniqueness** – ensure that the value being updated is not already in use.
 4. **Repeater Fields** – validated fields within a [Repeater Field](http://www.advancedcustomfields.com/add-ons/repeater-field/).
 5. **Read Only** – specify a field as read-only allowing it to be displayed but not
    updated.
 6. **WordPress Multi Language** – compatible with multilingual sites using the WPML
    plugin.
 7. **Conditional Logic** – show and hide validated fields based on the values of other“
    switch” fields.

#### Compatibility

Requires [Advanced Custom Fields](https://wordpress.org/extend/plugins/advanced-custom-fields/)
version 4.0 or greater.

## Screenshots

 * [[
 * Example configuration for input masking and regular expression checking of a 
   telephone number field.
 * [[
 * Example of client-side input masking on a telephone number field.
 * [[
 * Example of failing to pass a regular expression check (phone number is incomplete).
 * [[
 * Example of failing to pass a uniqueness check – the telephone number is already
   in use by post “Test 1”.
 * [[
 * Example of PHP validation configuration. This code will fail if the request comes
   from “127.0.0.1” with the message “You cannot save from localhost!”.
 * [[
 * Example of client side PHP validation failure.

## Installation

 1. Download the plugin and extract to the `/wp-content/plugins/` directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
 3. Configure validated fields within the Advanced Custom Fields menus.

## FAQ

  I’ve activated the Validated Field plugin, but nothing happens

Ensure that you have [Advanced Custom Fields](https://wordpress.org/extend/plugins/advanced-custom-fields/)
installed and that it is activated.
 Validated Field will appear as a new input 
type in the field group editor.

  Configuration Options

Global configurations for the Validated Field plugin can be found in the WordPress
Admin under `Custom Fields > Validated Field Settings`.

## Reviews

![](https://secure.gravatar.com/avatar/a19412b04521bfc6a1148a64d7a7e2e6cba87bfcfc6396799b6cf22a83e8cc63?
s=60&d=retro&r=g)

### 󠀁[does not work with 6.9](https://wordpress.org/support/topic/does-not-work-with-6-9/)󠁿

 [quandt](https://profiles.wordpress.org/quandt/) Kerzu 17, 2025

Nope, crashes things. Be neat to update it. A simple regex on ACF (client side) 
fields would cover the 99% use case I can think of. Don’t see the point of upgrading
to a pro version of ACF plus some other ‘free’ just for regex (after all regex has
been around since the 60’s)

![](https://secure.gravatar.com/avatar/b87644f25200be1605031513a75b9cd31cba292159b9942c7d5bec55b37b8f9c?
s=60&d=retro&r=g)

### 󠀁[Doesn’t work in ACF Pro 5.6.2](https://wordpress.org/support/topic/doesnt-work-in-acf-pro-5-6-2/)󠁿

 [Jules Colle](https://profiles.wordpress.org/jules-colle/) Gwengolo 30, 2017

Adding my one star to inform people that this plugin is no longer working

![](https://secure.gravatar.com/avatar/b38efc41cc224126770f8e6710ab0784a26c720d93a075dcd4000d369c661b67?
s=60&d=retro&r=g)

### 󠀁[Doesn’t work with ACF 5.5](https://wordpress.org/support/topic/doesnt-work-with-acf-5-5/)󠁿

 [BenM](https://profiles.wordpress.org/alysko/) Kerzu 13, 2016

It was a good plugin but unfortunately, it doesn’t work anymore.

![](https://secure.gravatar.com/avatar/e38681de00bc71d21fdcd7162975086f46f8433d82518277099d79ce17ad0dc9?
s=60&d=retro&r=g)

### 󠀁[Still works](https://wordpress.org/support/topic/still-works-100/)󠁿

 [plastisound](https://profiles.wordpress.org/plastisound/) miz Du 16, 2016

We use the extensión for custom develop and it’s a great surprise solve/fix/finish
a part of code with this plugin. Thanks

![](https://secure.gravatar.com/avatar/241aec5dd577c986599aa49f4386a034ffb212e27eeac672b63fdc3c44366414?
s=60&d=retro&r=g)

### 󠀁[Must have Powerfull acf addon!](https://wordpress.org/support/topic/must-have-powerfull-acf-addon/)󠁿

 [gino8080](https://profiles.wordpress.org/gino8080/) Gwengolo 3, 2016

Easy to use and powerfull addon for acf, you can validate with regex or php function!
Must have!

![](https://secure.gravatar.com/avatar/efd60972670dbf86de6f105f405182d001b05b087530aaabc02cbadcb3519d52?
s=60&d=retro&r=g)

### 󠀁[Straightforward to use](https://wordpress.org/support/topic/straightforward-to-use/)󠁿

 [hectic](https://profiles.wordpress.org/hectic/) Gwengolo 3, 2016

Easy to implement validation. Essential for projects using ACF.

 [ Read all 22 reviews ](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/)

## Contributors & Developers

“Advanced Custom Fields: Validated Field” is open source software. The following
people have contributed to this plugin.

Contributors

 *   [ doublesharp ](https://profiles.wordpress.org/doublesharp/)

[Translate “Advanced Custom Fields: Validated Field” into your language.](https://translate.wordpress.org/projects/wp-plugins/validated-field-for-acf)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/validated-field-for-acf/),
check out the [SVN repository](https://plugins.svn.wordpress.org/validated-field-for-acf/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/validated-field-for-acf/)
by [RSS](https://plugins.trac.wordpress.org/log/validated-field-for-acf/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.7.7

 * ACF4
    - Update `json_encode()` to support PHP 5.2.

#### 1.7.6

 * ACF4
    - Update for jQuery mask compatibility with ACF version 4.4.2+.
    - Improved support for use of single and double quotes within the validation
      pattern.
    - Use the same `eval()` implementation as ACF5 handler.
    - Derive add-on file basename for error handling.
 * ACF5
    - Update for jQuery mask compatibility with ACF version 5.2.7+.
    - Derive add-on file basename for error handling.
 * Additional jQuery Masked Input options:
    - `Autoclear`: `Yes` or `No` – determine if a value should be automatically 
      cleared if it does not match the mask. The previous default was `Yes`.
    - `Placeholder`: ‘char or string` – use a different character or string as a
      placeholder to be displayed as the user is entering their input.
 * Filters for future add-on support.
 * Updated Spanish translations.
 * Added Serbo-Croatian translations courtesy of Andrijana Nikolic / [WebHostingGeeks](http://webhostinggeeks.com/).

#### 1.7.5

 * Update for compatibility with ACF version 5.2.6+.

#### 1.7.4

 * Update CSS to properly handle visibility of validated fields via conditional 
   logic when the default visibility is hidden for new entries.
 * Bug fix: Remove warning when trying to access the Post ID when it is not available,
   on Options pages for example.

#### 1.7.3

 * Replace call to `acf_render_field_settings()` with action `acf/render_field_settings/
   type=?` to support ACF 5.2.3+.

#### 1.7.2

 * Allow `$message` to be returned from PHP code instead of `false` to fail validation.
    - Example code: `if ( !filter_var( $value, FILTER_VALIDATE_URL ) ) return 'You
      must use a valid URL.';`
    - Validation will fail if `$value` is not a URL, otherwise the default validation
      return is `true`.
 * Clean up handling of read only/hidden select fields.
 * Include additional default sub field values to prevent array index errors.
 * Update to work with the latest version of ACF JavaScript validation – requires
   nested `DIV` to properly append error message to the correct input field.

#### 1.7.1

 * Update for compatibility with new Repeater/select2 implementation in ACF.
 * Dynamically copy field from parent to sub field allowing for greater flexibility
   in sub field type support.
 * Remove old code/comments.
 * Bug fix: Only trigger “change” event on sub field type when the field is a clone,
   not an existing field.
 * Bug fix: Fix processing of sub field “name” to correctly trigger ACF filters.

#### 1.6

 * Show info/error message when input masking is used with the “number” field type
   as they are not compatible.
 * Upgrade to jQuery Masked Input version 1.4.1.
 * **ACF5 only:**
    - Include unique value options of “Post” and “Post + Key”.
    - Check submitted values for duplicates when the field type is unique. This 
      fixes the issue where duplicate values are added to a unique repeater field,
      or the same value is entered for multiple meta_keys when the unique type is“
      global”, “post type”, or “post”.
 * Bug fix: Correctly call `$wpdb->esc_like()` as instance method for “globally 
   unique” fields.
 * Bug fix: Improve field/sub field handling and to correctly populate “id” for 
   use in HTML CSS selectors.

#### 1.5.1

 * Bug fix: Use better supported PHP syntax for getting repeater field index, props
   @dnrms.

#### 1.5

 * Increase height of ACE editor.
 * Improve jQuery selectors for WordPress Admin functionality.
 * Replace deprecated `like_escape()` function with `$wpdb->esc_like()`.
 * Update read-only icon on edit screens.
 * Bug fix: Undefined array index errors.
 * Bug fix: Repeater field unique validation for post type and post type + key.
 * Bug fix: WPML field unique validation for post type and post type + key.
 * Bug fix: UI display controls for pattern/ACE editor.

#### 1.4

 * Support for Advanced Custom Fields 5.0.
 * The `$inputs` variable is now available using and index of `meta_key` and returning
   an array with the values “field”, “value”, and “prev_value”.
 * Fix for custom “post_id” string value instead of and integer value.
 * Host `ace.js` libraries locally and upgrade to version 1.1.7.
    - Increase size of PHP editor.
    - Support for PHP snippets and autocomplete.
    - New editor functions: Search (`Ctrl+F`/`Cmd+F`), Replace (`Ctrl+Alt+F`/`Cmd
      +Opt+F`), and Replace All (`Ctrl+Alt+Shft+F`/`Cmd+Opt+Shft+F`).
 * Host `fontawesome.css` CSS and fonts locally and upgrade to version 4.2.
 * Upgraded jQuery Masked Input plugin to version 1.4.
 * Better support for Relationship field settings – only load sub field when the
   action is `acf/fields/relationship/query_posts` (ACF4) or `acf/fields/relationship/
   query` (ACF5).
 * For ACF 5+ only:
    - The new [`acf/validate_value`](http://www.advancedcustomfields.com/resources/acf-validate_value/)
      filter is used for better compatibility and performance.
    - Get rid of inline JavaScript in the WordPress Admin and leverage ACF JavaScript
      events.
 * For ACF 4 only:
    - Compatibility with tabbed layouts (natively supported in ACF 5)

#### 1.3.1

 * Bug Fix: Apply input masking to fields for new posts, not just editing existing
   ones.

#### 1.3

 * Support front end validation using [`acf_form()`](http://www.advancedcustomfields.com/resources/functions/acf_form/).
 * Support for WPML, props @gunnyst.
 * Move configuration to WordPress Admin under `Custom Fields > Validated Field 
   Settings`.
    - Debug – enable debugging, defaults to off.
    - Drafts – enable draft validation, defaults to on.
    - Front End – enable front end validation, defaults to off.
    - Front End Admin CSS – enable `acf_form_head()` to enqueue an admin theme, 
      defaults to on.
 * Improved SQL for unique queries to support Relationship fields – check both arrays
   and single IDs.
 * Fix conflicts with ACF client side validation (required fields, etc).
 * Fix reference to `$sub_field['read_only']` with `$field['read_only']` for jQuery
   masking, props @johnny_br.

#### 1.2.7

 * Bug Fix: Post Preview fix when WordPress ‘click’ event triggers a ‘submit’ before
   the clicked element can be tracked by the plugin.
 * Added comments to unpacked JavaScript.

#### 1.2.6

 * Critical Bug Fix: Fix compatibility issues with Firefox.

#### 1.2.5.1

 * Remove debug `error_log()` statement from v1.2.5.

#### 1.2.5

 * Finish text localization, include `es_ES` translation.
 * Pack and compress validation javascript.
 * Bug Fix: prevent PHP array index notice for non-repeater fields.
 * Code formatting.

#### 1.2.3

 * Support for globally bypassing Draft/Preview validation by setting `ACF_VF_DRAFTS`
   to `false`.
 * Support for bypassing Draft/Preview validation per field (defaults to validate).
 * Bug fixes: properly hide Draft spinner, cleaned up JavaScript.

#### 1.2.2

 * Properly include plugin version number on JavaScript enqueue for caching and 
   PHP notices.
 * Use minified JavaScript unless `ACF_VF_DEBUG` is set to `true`.
 * Tested up to WordPress 3.9.1

#### 1.2.1

 * Show ‘Validation Failed’ message in header as needed.
 * Mark form as dirty when input element values change.
 * Fix return of `$message` from field configuration to UI.

#### 1.2

 * Support for [Repeater Field](http://www.advancedcustomfields.com/add-ons/repeater-field/)
   Validated Fields.
 * Support for debugging with `ACF_VF_DEBUG` constant.
 * Clean up variable names, more code standardization.
 * Better handling of required fields with validation.

#### 1.1.1.1

 * Remove debug `error_log()` statement from v1.1.1.

#### 1.1.1

 * Clean up PHP to WordPress standards.
 * Fix PHP Notice breaking AJAX call.
 * Use defaults to prevent invalid array indexes.
 * Update JavaScript for UI Errors.
 * More localization prep for text.

#### 1.1

 * Add Read-only functionality (beta).
 * Use standard ACF error/messaging.
 * Correctly process “preview” clicks, fixes error where the post would be published.
 * Register CSS only in required locations.
 * Properly apply subfield filters for `acf/load_value/type=`, `acf/update_value/
   type=`, `acf/format_value/type=`, `acf/format_value_for_api/type=`, `acf/load_field/
   type=`, `acf/update_field/type=`.
 * Tested up to WordPress 3.9.

#### 1.0.7

 * Critical bug fix for selecting Validated Field type.

#### 1.0.6

 * Bug fix `$sub_field` properties not saving (use `acf/create_field_options` action).
 * Bug fix multiple Validated Fields in a set – correct to always use unique selectors.
 * Allow for unique query to be run on selected post statuses.
 * Set default statuses included in unique queries with filter of `acf_vf/unique_statuses`.
 * Remove redundant table wrapper on validated fields.
 * Clean up potential strict PHP warnings.

#### 1.0.5

 * Hide spinner for update if a validation error is encountered.
 * Allow for uniqueness queries to apply to only published or all post statuses.
 * Clean up debugging code writing to the error log for regex validations.

#### 1.0.4

 * Fix javascript error when including ace.js, props @nikademo.
 * Fix “Undefined index” PHP notice, props @ikivanov.

#### 1.0.3

 * Bug fix for unique field values per `post_type`. Props @ikivanov.

#### 1.0.2

 * Bug fix for editing a validated field. Ensure proper type is selected and UI 
   refresh is triggered. Props @fab4_33.

#### 1.0.1

 * Clean up strict warnings

#### 1.0

 * Update for compatibility with Advanced Custom Fields 4+
 * Implement ace.js for syntax highlighting

#### 0.1

 * Initial version.

## Meta

 *  Version **1.7.7**
 *  Last updated **11 years ago**
 *  Active installations **200+**
 *  WordPress version ** 3.0 or higher **
 *  Tested up to **4.3.34**
 *  Language
 * [English (US)](https://wordpress.org/plugins/validated-field-for-acf/)
 * Tags
 * [acf](https://bre.wordpress.org/plugins/tags/acf/)[advanced custom fields](https://bre.wordpress.org/plugins/tags/advanced-custom-fields/)
   [regex](https://bre.wordpress.org/plugins/tags/regex/)[validate](https://bre.wordpress.org/plugins/tags/validate/)
   [validation](https://bre.wordpress.org/plugins/tags/validation/)
 *  [Advanced View](https://bre.wordpress.org/plugins/validated-field-for-acf/advanced/)

## Ratings

 4.5 out of 5 stars.

 *  [  19 5-star reviews     ](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/?filter=2)
 *  [  3 1-star reviews     ](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/)

## Contributors

 *   [ doublesharp ](https://profiles.wordpress.org/doublesharp/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/validated-field-for-acf/)