ACF query-pass field value

SOLUTION: $posts = get_field(‘choose_office’); if( $posts ): foreach(array_slice($posts, 0, 1) as $post): setup_postdata($post); $post_ID = get_the_ID(); endforeach; wp_reset_postdata(); endif; $args = array( ‘meta_query’ => array( array( ‘key’ => ‘office’, // name of custom field-post object ‘value’ => $post_ID, //name of relationship field ‘compare’ => ‘LIKE’ ), ), ); Solution from question: https://stackoverflow.com/questions/46816190/using-post-id-inside-reverse-acf-relationship-querie

Single query for multiple categories

If you’re running a website that has a high traffic, querying posts on each load will not be efficient. You should instead cache the data. Now, I’m not talking about a plugin that caches the pages, I’m talking about caching your query. You can run 10 queries and fetch 10 post IDs from each category, … Read more

WPQuery loop not giving expected output

It was a little bit hard to understand the question at first, but… If all you want to do is to sort properties by some custom field, then there’s no need to create custom WP_Queries and all that code you wrote… All you need to do is to add sorting params to the main query … Read more