WordPress Development Stack Exchange is a question and answer site for WordPress 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

Whenever adding an empty line between paragraphs using TinyMCE, the   character entity is added.

How can I strip the content of all instances of this character whenever an author updates their post (save_post)?

share|improve this question
up vote 4 down vote accepted

Figured it out, hooking into content_save_pre:

function remove_empty_lines( $content ){

  // replace empty lines
  $content = preg_replace("/ /", "", $content);

  return $content;
add_action('content_save_pre', 'remove_empty_lines');
share|improve this answer
just remember to mark your own answer as accepted. – Pieter Goosen Mar 13 '14 at 9:30

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.