Home › Forums › Backend Issues (wp-admin) › update_field if field is empty else continue › Reply To: update_field if field is empty else continue
Must of the time the field vale will be false or NULL if it is empty. You need to check for empty
if(empty(get_field($term_id)) {
this might also work
if (!get_field($term_id)) {
However, this could be a problem if the actual value of the field is something that evaluates to empty but is a valid value, for example an empty string, 0, false, etc. So depending on the type of field you might need to check for different things.
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.