Hi, How do I target a particular fields in a particular form? Currently this field is in my Edit Profile form. I have a Sign Up form that has the same input field. I want to make the field not required only on that Edit Profile form. Below is what I have, I did some digging and I found using is_page() would work but when I go to my sign up form the field is missing.
add_filter('acf/load_field/name=employers_name', 'my_acf_load_employers_name');
function my_acf_load_employers_name( $field ) {
if( is_page('edit-profile') ) {
// make required
$field['required'] = false;
// return
return $field;
}
}
You are only returning the field if you change the setting. You need to always return the field
add_filter('acf/load_field/name=employers_name', 'my_acf_load_employers_name');
function my_acf_load_employers_name( $field ) {
if( is_page('edit-profile') ) {
// make required
$field['required'] = false;
}
// return
return $field;
}