Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a new drupal 7 installation, I'm trying to get line breaks to show up correctly when saved. I have wysiwyg and tinymce installed through using the panopoly distribution. When I try to do more space after a paragraph (by hitting enter twice), it will generate two empty paragraph tags, such as <p></p><p></p>. This however won't provide the needed space as they are empty. In an earlier (drupal 6) project, when I tested this behavior it would insert paragraphs with &nbsp; in them which correctly displayed the line breaks. For example: <p>&nbsp;</p><p>&nbsp;</p>

Is there any way to get this behavior back in Drupal 7?

I've played around with the wysiwyg settings, and text formats, but I can't find a combination of settings that will work.

share|improve this question
up vote 1 down vote accepted

It turns out this has something to do with the "WYSIWYG filter" under text formats (admin/config/content/formats). Disabling this gave my non-breaking space back. You would probably want to adjust the configuration rather than just turning it off.

share|improve this answer

The followin setup works in my Drupal 7 TinyMCE configuration:

  1. Turn off the WYSYWIG filter on the admin/config/content/formats page.
  2. Configure the 'Limit Allowed HTML tags' filter to allow for


Note: Filters are configured at admin/config/content/formats/MY_FILTER_NAME

share|improve this answer


Drupal 6: Removed the CHARACTER REPLACEMENT "?" FOR NON-BREAKING-SPACE TAG in P tags from wysiwyg. The empty p tags were formerly placed to denote a change of line, however Drupal wysiwyg automatically adds a NON-BREAKING-SPACE TAG which thereby fail to display properly and thus be replaced with the CHARACTER REPLACEMENT "?"

Drupal 7: No nbsp tag but empty p tags

Working Solution:

$to_filter = array('bloc_1_delta', 'bloc_2_delta', 'bloc_3_delta', 'bloc_4_delta');
if (in_array($vars['block']->delta, $to_filter)) {
    $vars['block']->content = str_replace("<p></p>", "<br/>", mb_convert_encoding($vars['block']->content, 'HTML-ENTITIES', 'UTF-8'));
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.