Home › Forums › General Issues › Empty field label/name › Reply To: Empty field label/name
As I wrote in my first post, I use my wordpress instalation in a non-standard way. It’s used because it provides a great amount of useful functions + admin interface, but on the frontent I have my custom .php files which load wordpress with the SHORTINIT param. And I have also my custom database queries to get the ACF fields, because the plugins are not loaded on SHORTINIT. As I wrote I need to pass the fields as an object to ajax response, to have it in my frontend javascript, so I create an object of fields, $obj->field_name = 'field_value'
. If there was an empty field without name, without label, it caused error because of trying to create an object property with empty name
$prop_name = null;
$obj->$prop_name = $field_val; // error!
Of course, I can just check if the field name is not empty, but I think it should be done during saving a field, because I’m sure no one needs a field without name, but one can create it ‘by accident’.
Just for rules, logically when the field is marked as required, and it really is required, it should be required.
Please consider adding this one or two lines of code, in the next version 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.