Title: Field Helper Functions For ACF Pro
Author: Andrew Whittaker
Published: <strong>10 de agosto de  2025</strong>
Last modified: 10 de agosto de  2025

---

Buscar plugins

![](https://ps.w.org/field-helper-functions-for-acf-pro/assets/banner-772x250.png?
rev=3342354)

Este plugin **no se ha probado con las últimas 3 versiones mayores de WordPress**.
Puede que ya no tenga asistencia ni lo mantenga nadie, o puede que tenga problemas
de compatibilidad cuando se usa con las versiones más recientes de WordPress.

![](https://ps.w.org/field-helper-functions-for-acf-pro/assets/icon-256x256.png?
rev=3342354)

# Field Helper Functions For ACF Pro

 Por [Andrew Whittaker](https://profiles.wordpress.org/awhittaker/)

[Descargar](https://downloads.wordpress.org/plugin/field-helper-functions-for-acf-pro.1.1.0.zip)

 * [Detalles](https://es-ar.wordpress.org/plugins/field-helper-functions-for-acf-pro/#description)
 * [Valoraciones](https://es-ar.wordpress.org/plugins/field-helper-functions-for-acf-pro/#reviews)
 *  [Instalación](https://es-ar.wordpress.org/plugins/field-helper-functions-for-acf-pro/#installation)
 * [Desarrollo](https://es-ar.wordpress.org/plugins/field-helper-functions-for-acf-pro/#developers)

 [Soporte](https://wordpress.org/support/plugin/field-helper-functions-for-acf-pro/)

## Descripción

This plugin provides a set of simple, powerful helper functions to reduce boilerplate
code and streamline the process of retrieving and displaying ACF field values in
your templates. It includes helpers for getting single values (with support for 
nested groups), and for easily looping over repeater fields. The plugin is built
with security and best practices in mind, ensuring that all output can be properly
escaped.

### Features:

 * `get_acf()`: A versatile function to get any field value. It supports dot notation
   for nested group fields and automatically handles `get_sub_field()` context within
   repeaters.
 * `repeater()`: A clean way to loop through repeater fields with callbacks. Includes
   optional callbacks for before and after the main loop, and allows passing an 
   arguments array to the row callback. (Requires ACF Pro)
 * `get_repeater_field()`: Fetch a specific sub-field value from a specific row,
   or an array of all values for a sub-field across all rows. (Requires ACF Pro)
 * Lightweight and secure.
 * Logs to the PHP error log for easy debugging.

### Usage Examples:

### get_acf()

This is your main function for retrieving any ACF field value.

 1. **Basic Usage:** Get the value of a text field named `page_headline`.
 2.     ```
        <h1><?php echo get_acf('page_headline'); ?></h1>
        ```
    
 3. **Providing a Default Value:** If the `page_subtitle` field might be empty, provide
    a fallback.
 4.     ```
        <h2><?php echo get_acf('page_subtitle', 'This is a default subtitle'); ?></h2>
        ```
    
 5. **Escaping HTML:** When outputting a value inside an HTML attribute, always escape
    it.
 6.     ```
        <?php
        $alt_text = get_acf('image_alt_text', 'Default alt text', 'attr');
        echo '<img src="..." alt="' . $alt_text . "'>";
        ```
    

Other escape options: `html`, `url`, `js`, `text`.

 1. **Getting a Value from an Options Page:** To get a field value from an ACF Options
    Page, pass `option` as the `$post_id`.
 2.     ```
        <?php
        $footer_copyright = get_acf('footer_copyright_text', '', 'html', 'option');
        ```
    
 3. **Getting a Value from a Nested Group Field:** Use dot notation to access fields
    inside a group.
 4.     ```
        <?php
        $phone = get_acf('contact_details.phone_number');
        ```
    
 5. **Automatic Sub Field Usage:** Inside a standard ACF `have_rows` loop, `get_acf()`
    automatically uses `get_sub_field()` so you don’t have to change your function 
    calls.
 6.     ```
        <?php
        if (have_rows('team_members')) :
            while (have_rows('team_members')) : the_row();
                // This correctly gets the 'member_name' sub field for the current row.
                echo '<h3>' . get_acf('member_name', '', 'html') . '</h3>';
            endwhile;
        endif;  
        ```
    

### repeater() (ACF Pro Only)

This function simplifies looping over repeater fields.

 1. **Basic Repeater Loop:** To display a list of testimonials from a repeater named`
    testimonials` with a sub-field `testimonial_text`:
 2.     ```
        <?php
        repeater('testimonials', function($index) {
            echo '<blockquote>' . get_acf('testimonial_text', '', 'html') . '</blockquote>';
        });
        ```
    
 3. **Using Before and After Callbacks:** To wrap your repeater output in `<ul>` and`
    <li>` tags.
 4.     ```
        <?php
        repeater(
            'service_list',
            function($index) { // Main row callback
                echo '<li>' . get_acf('service_name') . '</li>';
            },
            [], // No args needed for this example
            function() { // Before callback
                echo '<ul>';
            },
            function() { // After callback
                echo '</ul>';
            }
        );
        ```
    
 5. **Passing Arguments to the Callback:** To make your repeater template more reusable,
    pass in arguments.
 6.     ```
        <?php
        $args = [
            'item_class' => 'faq-item',
            'heading_level' => 'h3'
        ];
    
        repeater(
            'faqs',
            function($index, $args) {
                printf('<div class="%s">', esc_attr($args['item_class']));
    
                printf(
                    '<%s>%s</%s>',
                    esc_attr($args['heading_level']),
                    esc_html(get_acf('question')),
                    esc_attr($args['heading_level'])
                );
    
                echo '<div>' . get_acf('answer', '', 'html') . '</div></div>';
            },
            $args
        );  
        ```
    

### get_repeater_field() (ACF Pro Only)

Use this to get data from a repeater field without looping through it manually.

 1. **Get All Values from a Sub-Field:**
 2.     ```
        <?php
        $all_attendees = get_repeater_field('event_attendees', 'attendee_name');
        // $all_attendees is now an array: ['John Doe', 'Jane Smith', ...]
    
        echo '<p>Total attendees: ' . count($all_attendees) . '</p>';
        ```
    
 3. **Get a Value from a Specific Row:**
 4.     ```
        <?php
        // Row index is 0-based, so 2 is the third row.
        $third_image = get_repeater_field('slider', 'slide_image', 2);
    
        if ($third_image) {
            // $third_image will contain the image array/ID from ACF
            echo wp_get_attachment_image($third_image, 'large');
        }
        ```
    

## Instalación

 1. Upload the acf-field-helpers folder to the /wp-content/plugins/ directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
 3. Ensure you have Advanced Custom Fields (and ACF Pro for repeater functions) installed
    and activated.

## Preguntas frecuentes

### Does this work with the free version of ACF?

No. Whilst the `get_acf()` function will work with the free version of ACF, all 
other functions will not so we chose to limit the plugin to the Pro version only.

### How do I use the new $args parameter in the repeater() function?

You can now pass an array of arguments to the `repeater()` function. This array 
will be available as the second parameter in your row callback function. See the“
Usage Examples” section for a detailed example.

## Reseñas

No hay reseñas para este plugin.

## Colaboradores y desarrolladores

“Field Helper Functions For ACF Pro” es un software de código abierto. Las siguientes
personas han colaborado con este plugin.

Colaboradores

 *   [ Andrew Whittaker ](https://profiles.wordpress.org/awhittaker/)

[Traduce “Field Helper Functions For ACF Pro” a tu idioma.](https://translate.wordpress.org/projects/wp-plugins/field-helper-functions-for-acf-pro)

### ¿Interesado en el desarrollo?

[Revisa el código](https://plugins.trac.wordpress.org/browser/field-helper-functions-for-acf-pro/),
echa un vistazo al [repositorio SVN](https://plugins.svn.wordpress.org/field-helper-functions-for-acf-pro/),
o suscríbete al [log de desarrollo](https://plugins.trac.wordpress.org/log/field-helper-functions-for-acf-pro/)
por [RSS](https://plugins.trac.wordpress.org/log/field-helper-functions-for-acf-pro/?limit=100&mode=stop_on_copy&format=rss).

## Registro de cambios

#### 1.1.0

 * Added detailed “Usage Examples” section to readme.txt.
 * Refactored plugin into a main file and an includes/functions.php file for better
   organisation.
 * Updated repeater() function to accept an $args array, which is then passed to
   the row callback.

#### 1.0.0

 * Initial release.
 * Added get_acf(), repeater(), and get_repeater_field() helper functions.
 * Updated repeater() to include before and after loop callbacks.
 * Changed logging from qm() to error_log().

## Meta

 *  Versión **1.1.0**
 *  Última actualización **hace 1 año**
 *  Instalaciones activas **Menos de 10**
 *  Versión de WordPress ** 5.0 o superior **
 *  Testeado hasta **6.8.11**
 *  Versión de PHP ** 7.4 o superior **
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/field-helper-functions-for-acf-pro/)
 * Etiquetas:
 * [acf](https://es-ar.wordpress.org/plugins/tags/acf/)[advanced custom fields](https://es-ar.wordpress.org/plugins/tags/advanced-custom-fields/)
   [development](https://es-ar.wordpress.org/plugins/tags/development/)[utilities](https://es-ar.wordpress.org/plugins/tags/utilities/)
 *  [Vista avanzada](https://es-ar.wordpress.org/plugins/field-helper-functions-for-acf-pro/advanced/)

## Valoraciones

Todavía no se enviaron reseñas.

[Your review](https://wordpress.org/support/plugin/field-helper-functions-for-acf-pro/reviews/#new-post)

[Ver todas las reseñas](https://wordpress.org/support/plugin/field-helper-functions-for-acf-pro/reviews/)

## Colaboradores

 *   [ Andrew Whittaker ](https://profiles.wordpress.org/awhittaker/)

## Soporte

¿Tenés algo que decir? ¿Necesitás ayuda?

 [Ver el foro de asistencia](https://wordpress.org/support/plugin/field-helper-functions-for-acf-pro/)