WordPress Plugin: validated-field-for-acf
This plugin will create an add-on field wrapper for Advanced Custom Fields (ACF in the WordPress Plugin Repository) that will give you additional validation functionality – PHP functions, regular expression, input field masking, and uniqueness (post type/meta key, meta key, or site-wide). You can find and install the plugin from the WordPress repository, located at http://wordpress.org/extend/plugins/validated-field-for-acf/.
UPDATED: This plugin is compatible with Advanced Custom Fields 4 & 5
The plugin code
This file is always up to date based on the trunk of the WordPress.org SVN repository.
validated_field.php
<html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
validated_field_v4.php
<html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
validated_field_v5.php
<html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
js/input.js
<html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
css/input.css
<html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> <hr><center>nginx</center> </body> </html>
Hi Justin, the plugins is not working anymore with the last version of wordpress. Are you planning to fix? The error is …
Declaration of acf_field_validated_field::validate_field($valid, $value, $field, $input) should be compatible with acf_field::validate_field($field)
Thanks
Hi Felipe,
I started working on an updated version several years(!) ago, but haven’t been able to find time to finish it. The site I originally wrote this plugin for is no longer running and as it’s not a profitable endeavor unfortunately it’s likely to be on the back burner for some time. If you are interested I can share the new code that I started although it is likely out of date at this point as well, and was never complete to begin with.
Thanks!
Justin
Hey Justin,
Thank you for good work.
I want to use UNIQUE validation ONCE only. How is it possible with your plugin? I will really appreciate your help since already tried my best but not able to make it happen.
Please help!
Best,
– Keshav
iNFOTYKE
This will take some custom coding outside of the Validated Field plugin, but you should be able to use it to access your API to make sure a value can only be submitted once. I posted a bit more info here: https://wordpress.org/support/topic/how-to-create-validation-for-unique-values-and-for-only-once
Justin
Hi Justin.
I’m new in wordpress and PHP.
I try to use your great plugin but I don’t know where I put the function to validate the field.
Can you help me?
Sorry for my very poor english, sorry for the inconvenience and thank you in advance.
Hi Joe,
Once you have the plugin added and activated choose “Validated Field” in the Custom Fields group where you want to add it. When you select it, you will then be given the chance to enter a subfield type (Text, Select, etc) and some additional entries to provide input masking and validation.