Found the according regex to filter the content string:
$Content = preg_replace('~\s?<p>(\s| )+</p>\s?~', '', $Content);
source
Only question where to implement it the best possible...
--- Edit: Did it with a filter plugin:
Setting up a filter plugin works:
1. File qa-plugin.php:
qa_register_plugin_module('filter', 'qa-filter-empty-paragraphs.php', 'qa_filter_empty_paragraphs', 'Filter Empty Paragraphs');
2. File qa-filter-empty-paragraphs.php
class qa_filter_empty_paragraphs {
var $directory;
function load_module($directory, $urltoroot)
{
$this->directory=$directory;
}
function filter_question(&$question, &$errors, $oldquestion) {}
function filter_answer(&$answer, &$errors, $question, $oldanswer) {
// replace empty p tags causing unnecessary line breaks, such as <p> </p>
$answer['content'] = preg_replace('~\s?<p>(\s| )+</p>\s?~', '', $answer['content']);
}
function filter_comment(&$comment, &$errors, $question, $parent, $oldcomment){}
}
=)