Beantown Design Beantown Design
  • Home
  • About
  • Services
  • Portfolio
  • Blog
  • Contact
Close
  • Home
  • About
  • Services
  • Portfolio
  • Blog
  • Contact

Remove Empty Paragraphs in WordPress with Javascript

November 1, 2014

Here’s a quick way to remove unwanted empty paragraph tags in WordPress.

If you use WordPress I’m sure you’ve dealt with extra formatting being added to your page by the WordPress TinyMCE editor. The quickest way to shut off this auto formatting is to disable autotop by adding this to your functions.php file:

remove_filter('the_content', 'wpautop');

I’m not a huge fan of that solution however, since I actually want the auto-formatting for the most part, just not the extra/empty paragraph tags. So instead I would use the following code, which simply removes any empty paragraph tags.

$('p:empty').remove();
Posted in: jQuery, WordPress Author: BeantownDesign

Share

FacebookTwitterGoogle +Pinterest

Leave a Reply / Cancel Reply

Follow @BeantownDesign

Categories

  • CSS
  • jQuery
  • Resources
  • WordPress

Need Hosting?

WP Backups

  • Back to Blog
  • Prev
  • Next

©2018 BeantownDesign / Website Hosting / WordPress Backups