Support

Account

Home Forums Front-end Issues Issue with Text Area in a Group field

Helping

Issue with Text Area in a Group field

  • Hi everyone,
    I have noticed an issue using a Text Area with auto <br> in a group field.
    By doing this, the <br> tag appear as a plain text, not as a HTML tag.

    Here is the code I am using:

    <?php
    $titraille = get_field('titraille');
    if( $titraille ): ?>
        <div class="center">
            <p class="sur_titre">
                <?php echo esc_attr( $titraille['sur_titre'] ); ?>
            </p><!--  .sur_titre -->
            <h1>
                <?php echo esc_attr( $titraille['titre'] ); ?>
            </h1>
            <h1>
                <?php echo esc_attr( $titraille['test_titre'] ); ?>
            </h1>
        </div><!--  .center -->
    <?php endif; ?>
  • This is because you are using esc_attr() on the value. ACF is adding the <br> tags and you are converting the < and > into html entities by using this function.

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

The topic ‘Issue with Text Area in a Group field’ is closed to new replies.