Custom queries with Kadence advanced query loops with Advanced Custom Fields relationship fields

While WordPress blocks and page builders provide web developers with a ton of options to craft websites, not everything can be accomplished through clicks and drags. Occasionally, we need to review available documentation and get our hands dirty with a little code to accomplish specific things. This is especially true when combining different plugins, as we must find ways to integrate the features of two (or more) independently developed software. In the WordPress space, where the availability and added features of plugins are virtually endless, effectively making different plugins work together is a valuable skill.

Yesterday, I saw a question on Facebook in the Web Creator Community (by Kadence WP) group asking how to filter posts returned by the Kadence advanced query loop block based on Advanced Custom fields relationship fields. To help out, I created a brief tutorial on how to use the advanced query loop block with ACF relationship fields.

Apologies for the low video quality. I didn’t realize I was only recording in 720p.

Documentation

Here’s the documentation from Kadence and Advanced Custom Fields:

https://www.kadencewp.com/help-center/docs/kadence-blocks/custom-queries-for-advanced-query-loop-block/

https://www.advancedcustomfields.com/resources/querying-relationship-fields/

Snippet

Here’s the code snippet from my example:

https://github.com/joelmcdwebworks/public-snippets/blob/main/kadence-custom-query-acf-relationships

Joel McDonald

Joel McDonald has over twenty years of experience in web design and development. He founded Comit Strategies, now McDonald Web Works, in 2012, where he provides web design, development, hosting, support, and consultation to small-to-medium-sized businesses and organizations.