Removing "blank" paragraph tags from TinyMCE
<p>This is the same issue as was asked here in 2012, which was not answered:</p>

<p><a href="https://stackoverflow.com/questions/11572183/using-regex-to-remove-empty-paragraph-tags-p-p-standard-str-replace-on-sp">Using regex to remove empty paragraph tags &lt;p&gt; &lt;/p&gt; (standard str_replace on &quot;space&quot; not working)</a></p>

<p>When I press enter in TINYMCE, it appears to enter empty paragraph tags like this:</p>

<pre><code>&lt;p&gt; &lt;/p&gt;
</code></pre>

<p>I wanted to remove them before saving the data to a MySQL table.</p>

<p>So I tried a simple fix:</p>

<pre><code>$post_content = str_replace('&lt;p&gt; &lt;/p&gt;', '', $content_from_mce);
</code></pre>

<p>And also:</p>

<pre><code>$post_content = str_replace('&lt;p&gt;&amp;nbsp;&lt;/p&gt;', '', $content_from_mce);
</code></pre>

<p>However, they do not work (e.g. the don't replace the apparently empty paragraph tags).</p>

<p>If I do this:</p>

<pre><code>$foo = utf8_encode($post_content);
</code></pre>

<p>And then check $foo: it shows as:</p>

<pre><code>&lt;p&gt;Â &lt;/p&gt;
</code></pre>

<p>So really it's not an empty paragraph tag, but I can't work out how to delete these blocks of text.</p>

<p>I've also tried these versions (not all at the same time - I mean in different runs...)</p>

<pre><code>$post_content = str_replace('&lt;p&gt;Â &lt;/p&gt;','',$post_content);
$post_content = preg_replace('~&lt;p&gt;\s*&lt;\/p&gt;~i','',$post_content);
$post_content = preg_replace('#&lt;p&gt;&amp;nbsp;&lt;/p&gt;#i','&lt;p&gt;&lt;/p&gt;', $post_content);
$post_content=str_replace("/&lt;p&gt; &lt;\/p&gt;/","",$post_content);
</code></pre>

<p>But none of them work.</p>