WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
[resolved] Not inserting line breaks in textarea (3 posts)

  1. sparky672
    Member
    Posted 2 months ago #

    I have the "convert new lines into <br/> tags" option set on my textarea fields but this is not working. No <br/> tags are inserted into the content and everything displays as one long string.

    I've tried adding an extra blank line between each line, but it makes no difference to how it displays as the browser naturally ignores extra whitespace.

    http://wordpress.org/plugins/advanced-custom-fields/

  2. sparky672
    Member
    Posted 2 months ago #

    Here’s my temporary workaround until the developer issues a permanent fix.

    In my template, where I insert the value of the textarea, I use a PHP nl2br.

    $my_textarea_value = get_post_meta(...);
    
    //echo $my_textarea_value; // instead of this
    
    echo nl2br($my_textarea_value); // do this
  3. sparky672
    Member
    Posted 2 months ago #

    I heard back from the developer. If I use the function, get_field(), which is provided automatically by his plugin, auto-BR works fine.

    $my_textarea_value = get_field(...);  // function is part of ACF plugin
    
    echo $my_textarea_value;

Reply

You must log in to post.

About this Plugin

About this Topic