WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

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

  1. sparky672
    Member
    Posted 2 years 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 years 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 years 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;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic