
I think I should FOREACH a part of the array. ? Is that a correct thinking?
Although this does not work, could you help me please? This is the last part in a long journey to develop my own booking system:
// Apply conditions to fields
add_filter('acf/prepare_field/name=bookings_field_time_session_1', 'yl_check_booking_exeptions_session_1');
function yl_check_booking_exeptions_session_1( $field ) {
// Retrieve option values. Date value should be like: 20200611 (unformatted)
$rows = get_field('bookings_settings_disabled_exceptions', 'bookings');
if( $rows ) {
foreach ( $rows as $row ) {
$option_date = get_sub_field('bookings_settings_disabled_date', 'bookings', false);
$date = date_i18n('Ymd', strtotime($option_date));
$session = get_sub_field('bookings_settings_disabled_session', 'bookings', false);
$arrays =
array(
array(
'field' => 'field_5ed4181bd63dc', // Time field session 1 in the form
'operator' => '!=', // If Value is different, then show the field
'value' => $session, // Compare against option page value
),
array(
'field' => 'field_5ed4178dd63d7', // Datepicker fiels in the form
'operator' => '!=', // If Value is different, then show the field
'value' => $date, // Compare against option page value
)
);
}
if ( $session == '1' ) {
$field['conditional_logic'] = array(
$arrays
);
}
}
// Return
return $field;
}
}

Thanks for looking into my code.
But it still only outputs 1 condition (session / date combi) although I have 3 entries in the option page… and the other entries don’t have any effect
This is the condition output I get for for the field:
data-conditions="[[{"field":"field_5ed4181bd63dc","operator":"==","value":"1"},{"field":"field_5ed4178dd63d7","operator":"!=","value":"20200627"}],[]]"
The whole code is this:
// Apply conditions to fields
add_filter('acf/prepare_field/name=bookings_field_time_session_1', 'yl_check_booking_exeptions_session_1');
function yl_check_booking_exeptions_session_1( $field ) {
// Retrieve option values. Date value should be like: 20200611 (unformatted)
if( have_rows('bookings_settings_disabled_exceptions', 'bookings') ) {
while ( have_rows('bookings_settings_disabled_exceptions', 'bookings') ) {
the_row();
$option_date = get_sub_field('bookings_settings_disabled_date', 'bookings', false);
$date = date_i18n('Ymd', strtotime($option_date));
$session = get_sub_field('bookings_settings_disabled_session', 'bookings', false);
if ( $session == '1' ) {
// Add the condition to the field
$field['conditional_logic'] = array(
// the first nested array holds OR conditions
// there would be a separate nested array for each OR condition
array(
// the second nesting is AND conditions
array(
'field' => 'field_5ed4181bd63dc', // Time field session 1 in the form
'operator' => '!=', // If Value is different, then show the field
'value' => $session, // Compare against option page value
),
array(
'field' => 'field_5ed4178dd63d7', // Datepicker fiels in the form
'operator' => '!=', // If Value is different, then show the field
'value' => $date, // Compare against option page value
)
),
array(
// this is an example, if there was an OR condition those would go here
)
);
}
}
}
// Return
return $field;
}

Anyone a workable solution for this?

Now I don’t see anything so the code is gone but the output becomes blank.
Just to mention again: The shortcodes are added to an ACF textarea field and that field is used as email BODY. So I do not use the regular content field from the post itself.
Any other ideas? I saw your example code online asiel and many people say it works so I guess it does but only for the regular content field and not for ACF fields?
I also tried to activate shortcode within ACF field by adding this to functions.php but again the same blank result:
add_filter('acf/format_value/type=textarea', 'do_shortcode');
add_filter('acf/format_value/type=text', 'do_shortcode');
Anything?

Jackpot!

The shortcake example that does not work. Within the email it outputs this [acf field=\"bookings_field_last_name\"]

@acf-support You’ve replied to my question here:
https://support.advancedcustomfields.com/forums/topic/field-updates-after-post-update
but I believe your given option in your first reply here above would be exactly what I need… I guess.
Am I correct?
What I want to accomplish:
– A visitor makes a booking > A pending post is make with the booking fields filled in inside (booking status is auto set to PENDING) > Admin sets booking status to CONFIRMED > Email to the customer is being send.
I thought your code would be just what I needed but no email is being send…
This is what should happen when OLD and NEW value do not match:
wp_mail( $to, $subject, $body, $headers );

Somehow I can’t post my code here so I had two update my question on STACK.
No errors come up but also NO emails are being send… Can you check the UPDATES code and give me some advise? I know I’m sooooo close here…
CODE:
https://stackoverflow.com/questions/62221356/wordpress-post-update-after-acf-field-updates
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.