Hey John thanks for your answer.
Im not happy that the backend then looks like before Gutenberg. It is quite disturbing for the backend-user to have two different views. Is there a roadmap to solve this issue?
Ok, thank you.
I came up with a new solution just to count the number of values inside the two arrays:
add_action('acf/save_post', 'my_project_updated_send_email_custom', 10);
function my_project_updated_send_email_custom( $post_ID ) {
/* new and old field value */
$dokumenteOld = get_field('field_5ba11346c0289', $post->ID);
$dokumenteNew = '';
if (isset($_POST['acf']['field_5ba11346c0289'])) {
$dokumenteNew = $_POST['acf']['field_5ba11346c0289'];
}
/* get elements in array */
$countOld = count($dokumenteOld);
$countNew = count($dokumenteNew);
}
Now the problem is that both containt the same number of values when i a add a new line in the repeater field (the new count). I also can see the new value in both arrays.
Sorry, this is the last quesiton i ask i promise. Thank you so much for your help!
Hey John, i did exactly as you described. My code is always executing. Is it possible because i use a repeater field which gives me back an array? Is it possible to check if a repeater field is changed?
Thank you so much for your help John. It helped me and i tried to get my solution. Im not the greatest programmer on earth and so my solutionis still not working. Can you maybe show me a short example of how i can compare the two field values inside my function and check if they are the same?
Thank you much and best regards.
Thank you, this helped me a lot. I know use an if statement in the template to check if it is a gif file and if then use the original image.
<?php if (exif_imagetype($image['url']) != IMAGETYPE_GIF) { ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php } else { ?>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php } ?>
Hi John
Thanks for your help. Sorry but i dont know how to use this acf-prepare_field for a specific field to set it read-only. Can you give me an example? Do i need the field key?
I just got back the id of the taxonomy. Which is actually what i need. I always thought it would give me back an array.
Now everything works!
Thanks for your help!
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.