Home › Forums › ACF PRO › acf_form no data on the frontend for individual field. › Reply To: acf_form no data on the frontend for individual field.
That is going to be more difficult. The only way I can think of, and I hate to say it, is to set and check a global variable.
// set global
global $my_current_form;
// set form to the current form being shown
$my_current_form = 'form 1';
// call acf form
acf_form(....
// add to filter
add_filter('acf/prepare_field/key=field_XXXXXXX', 'hide_acf_field_on_front');
function hide_acf_field_on_front($field) {
global $my_current_form ;
if (is_admin() || $my_current_form == 'form 1')) {
// allow field in admin
// allow the field on "form 1"
return $field;
}
// remove field
return false;
}
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.