• nitrospectide

    (@nitrospectide)


    I want to use the Post Meta query functionality to query by ACF fields. How can I get the right ACF field? Is it just the field name shown in ACF, or do they have some kind of prefix/other formatting I need to account for? Is there some place I can look and see the field names? What about the value? If an admin has entered ‘orange’ into a text field, your examples make it look like I should put in the text ‘orange’ without the quotes.

    Also, my particular use case is that I want to show all posts that link to a certain post in an ACF Relationship. Do I need to specify the value in some special way? The stored value is in an array.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ryan Welcher

    (@welcher)

    Hi and thanks for using AQL!

    You should be able to add the ACF field key to the Meta Key field. It will not auto-populate as it would with other post meta but hitting “enter” after type the name will lock it in.

    As for the value, if the admin entered ‘orange’ ( assuming without the quotes) then you would enter that same value without the quotes.

    Please keep in mind that the ACF fields will need to be exposed to the REST API for this to display correctly in the block editor.

    Unfortunately, without using a custom extension for AQL, I don’t think you’ll be able to display the posts linked in the ACF Relationship as it’s more complicated that simple post meta queries.

    Thread Starter nitrospectide

    (@nitrospectide)

    Thank you for the very helpful answers.

    Please keep in mind that the ACF fields will need to be exposed to the REST API for this to display correctly in the block editor.

    What do I need to do to do this?

    Unfortunately, without using a custom extension for AQL, I don’t think you’ll be able to display the posts linked in the ACF Relationship as it’s more complicated that simple post meta queries.

    How hard would this be to add? Can it be a feature request?

    Do you have a roadmap for your plans on this nice, and very much needed plugin? Have you ever looked at Drupal’s Views module? It’s an interesting model of a query builder for this sort of application.

    Plugin Author Ryan Welcher

    (@welcher)

    I just wanted to follow up here that as of version 2.1.0 ACF fields are now displayed in the auto-complete dropdown list for Post Meta Queries.

    What do I need to do to do this?

    You can follow this guide to enable an ACF field for the REST API.

    Do you have a roadmap for your plans on this nice, and very much needed plugin?

    Most my road map is driven by user requests. I would like to add some taxonomy tools in the future.

    Thread Starter nitrospectide

    (@nitrospectide)

    Ah! Nice. I just made use of this. I had a block that pulled up whatever the latest eBook is in our collection, and now I can create blocks that target specific eBooks based on unique values for the PDF filename ACF I have on each. This is very useful.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘ACFs with Post Meta query’ is closed to new replies.