ACF template code. Escaped and ready.
Choose a field type, name it, and copy secure template code: get_field(), have_rows() loops, return formats and output escaping done right.
Runs in your browser, nothing is uploaded Free, no sign-up No cookies, no tracking
Quick answer: To show an ACF field in a theme template, call get_field('field_name') (or the_field() to echo it) and escape the output for its type, for example esc_html() for text and esc_url() for URLs. Pick a field type above and this tool writes the full snippet, including repeater and flexible content loops.
Always escape ACF output
ACF returns stored values as they were saved. Escape them when you print: esc_html() for plain text, esc_url() for links and sources, esc_attr() inside attributes and wp_kses_post() for rich text from the Wysiwyg field. The generated snippets do this for you.
get_field() or the_field()?
get_field() returns the value so you can test it and escape it; the_field() echoes it unescaped. Use get_field() in templates and check the value before printing so empty fields leave no empty markup.
Repeaters and flexible content
Loop with have_rows() and the_row(), and read sub fields with get_sub_field(). Add sub fields above to see the loop. Flexible content adds a get_row_layout() switch for each layout.
- Pick the field type. Choose text, image, repeater, relationship or any other ACF field type.
- Name the field. Enter the field name exactly as it appears in your field group.
- Set the options. Match the return format, image size and context (current post, post ID, options page, term or user).
- Copy the code. Paste the template code into your theme file, or use the quick one-liner.
Frequently asked questions
Is the generated code safe to use?
It escapes output by field type, which is the recommended practice. Review it against your own return format settings before shipping.
Which context should I use?
Leave it on the current post inside the loop. Use a post ID for another post, option for an options page, and term or user to read fields saved on a taxonomy term or user profile.
Does it support ACF Pro fields?
Yes. Repeater, flexible content, gallery, group and clone-style layouts are covered, with loops for the ones that repeat.
Does it work with ACF Blocks?
The same get_field() calls work inside an ACF block template. Leave the context on the current post and ACF supplies the block data.
Is my field name sent anywhere?
No. Everything runs in your browser and nothing is uploaded.
Is there a WordPress plugin?
ACF Copilot by Developry adds live field previews, Ctrl+K field search, field group templates and cleanup tools inside the ACF editor.
Get the free browser extension
ACF Field Snippets for Chrome, Edge and Opera.