Support

Account

Home Forums Backend Issues (wp-admin) acf/render_field target by field ID

Helping

acf/render_field target by field ID

  • Hi,
    I am trying to use the acf/render_field to add custom html to the image field.

    I found that in the documentation

    function action_function_name( $field ) {
     
            echo '<p>Some extra HTML for the image field</p>';
     
    }
    add_filter( 'acf/render_field/image', 'action_function_name', 10, 1 );

    is it possible to target the image field by field ID like “field_508a263b40457“

    so I could inject different html on diferent image field?

    Thanks

  • 
    function action_function_name( $field ) {
      if ($field['key'] != 'your-field-key') {
        return;
      }
      echo '<p>Some extra HTML for the image field</p>';
    }
    add_filter( 'acf/render_field/image', 'action_function_name', 10, 1 );
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘acf/render_field target by field ID’ is closed to new replies.