TWIG相当于<?php the_field('field_name'); ?>?

I'm using Wordpress with the "Advanced Custom Fields" plugin, and I'm trying to call variables from the plugin into my TWIG file.

The documentation for the plugin says to use <?php the_field('field_name'); ?> in the PHP, but I can't figure out how to translate that code to TWIG.

I tried the following:

  • Running code as is (but it appears TWIG doesn't run pure PHP.)
  • {% post.the_field('my_fields_name') %}, but to no avail
  • {{ post.my_fields_name }}, but it printed/logged "Array" to the frontend.
  • {{ post.get_field('the_field', my_fields_name) }} and {{ post.get_field('the_field', 'my_fields_name') }}

Any help will be greatly appreciated

Took me a while, but ended up being an easy solution! Turns out these custom fields are stored in the meta-data, so all I had to do was {{ post.meta('my_fields_name') }}