Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 2 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 at 9:30

Your Answer

 
discard

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.