Support

Account

Home Forums General Issues Line breaks showing in text and text areas

Solving

Line breaks showing in text and text areas

  • I’m using text areas and text boxes, but when they’re submitted, any line breaks within the content of the text submitted are converted to </br> breaks. I’ve tried filtering wpautotop for ACF in particular with no change. Below is my code I’ve used to display the fields. What can I add to keep the breaks from appearing.

    /**
     *
     * Display a family profile using
     * Genesis column classes and ACF.
     *
     * @author Angie Meeker
     * @uses   Advanced Custom Fields
     */
    add_action( 'genesis_entry_content', 'family_profiles', 12 );
    function family_profiles() {
      if ( is_post_type_archive('family_profiles') )
    		return;
     
    	// Store the tour data
    	$family_data = array(
    		'family_ages' => get_field('family_ages'),
    		'family_diagnosis' => get_field('family_diagnosis'),
    		'family_challenges' => get_field('family_challenges'),
    		'family_advice' => get_field('family_advice'),
    		'family_quote' => get_field('family_quote'),
    	);
     
    	if ($family_data['family_ages'] != '' ||
    		$family_data['family_diagnosis'] != '' ||
    		$family_data['family_challenges'] != '' ||
    		$family_data['family_advice'] != '' ||
    		$family_data['family_quote'] != '' ) {
    		echo '<div class="tour-wrap">';
    			if ( $family_data['family_ages'] ) {
    				echo '<div class="location"><h4>How old are your family members diagnosed with Batten Disease?</h4> ' . esc_attr( $family_data['family_ages'] ) . '</div></br>';
    			}
    			if ( $family_data['family_diagnosis'] ) {
    				echo '<div class="location"><h4>When were they first diagnosed?</h4> ' . esc_attr( $family_data['family_diagnosis'] ) . '</div></br>';
    			}
    			if ( $family_data['family_challenges'] ) {
    				echo '<div class="location"><h4>What are the three biggest challenges you face each week?</h4> ' . esc_attr( $family_data['family_challenges'] ) . '</div></br>';
    			}
    			if ( $family_data['family_advice'] ) {
    				echo '<div class="location"><h4>What advice would you give to a family with a newly-diagnosed family member?</h4> ' . esc_attr( $family_data['family_advice'] ) . '</div></br>';
    			}
    			if ( $family_data['family_quote'] ) {
    				echo '<div class="location"><h4>Do you have a favorite quote or memory of your child that you’d like to share?</h4> ' . esc_attr( $family_data['family_quote'] ) . '</div>';
    			}
    		echo '</div>';
    	}
    }
  • What version of ACF are you using?

  • Have you set the text and textarea fields to “no formatting”?

  • Also, here’s a copy of my functions.php in case that helps. https://gist.github.com/ameeker/383a74135c1cd9a1e34c

  • Sorry for what might seem to be basic questions.

    I looked over these files quickly and I don’t see anything that stands out, but that doesn’t mean that there isn’t something going on in there. Also, I am not familiar with genesis so I don’t know if there’s anything in that framework or in genesis them you’re using that might cause it. There may also be other plugins that are causing a problem. I know that on my test installation of ACF4 that the problem you’re experiencing.

    My next suggestion is also going to be basic debugging. That is to deactivate other plugins and try one of the default 20XX themes to narrow down what is causing the problem.

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

The topic ‘Line breaks showing in text and text areas’ is closed to new replies.