Home Forums Front-end Issues Add custom field to Query Loop


Add custom field to Query Loop

  • Hi all,

    I’m using the new 2022 WordPress-template on my site. In the Visual Editor I want to add a custom field to the Query Loop to display an extra created ACF field.

    For this I use the [acf field="fieldname"] shortcode block to add this to the Query Loop. But, no matter what I try, the shortcode isn’t added correctly to the query. Only the value of the last record is shown in each of the article blocks.

    Could anyone helpe me out?

    Best regards,

  • After trying a few different solutions to adding ACF fields in a default WP Query Loop, I just found this solution. It seems very simple, and does appear to work fine in my intended use. I have it working on a HTML Block, so I can do whatever formatting is required.

    – Anyone know what potential issues this solution might cause in the future?

    It seems like it’s just replacing ‘wpautop’ with ‘do_shortcode’ on certain blocks that you enable. Just not sure of any potential cons to this approach. Just seems almost ‘too simple to be true’…

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.