Home › Forums › General Issues › my_acf_save_post and conditional issues › Reply To: my_acf_save_post and conditional issues
EDIT: Actually what ended up happening was as I was changing some varaibles I misspelled one of them.
After looking over everything it seems that my get_posts is not returning anything in the array and is NULL.
<?php $teamLeaders = get_posts(array( 'post_type' => 'mro_volunteer', 'meta_query' => array( array( 'key' => 'assigned_project', // name of custom field 'value' => '"' . get_the_ID() . '"', // matches exaclty 'compare' => 'LIKE' ) ) )); ?>
This is the correct post type and correct key, I checked the volunteers that are published and they all have the project in question assigned to them through the relationship field. I’m not sure why it can’t query them. It’s limited to only one if that makes any difference.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.