• It looks like WordPress is adding a <br> after the opening <p> element in blog posts and looking for a way to remove it. I already took the margin and padding off both h4 and p elements, but I’m still getting a gap. I know there’s a plugin that will strip out the auto generated <p> tags, but is there another option with using a plugin?

    http://airtechsite.staging.wpengine.com/parts-service/

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The function responsible is wpautop(). If you want it disabled entirely, remove it as a filter callback for “the_content” from a callback added to the “init” action. You can just disable the auto-br without affecting the auto-p behavior:

    add_action('init', 'gc_no_auto_br');
    function gc_no_auto_br() {
       remove_filter('the_content', 'wpautop');
       add_filter('the_content', function($c){ return wpautop($c, false);});
    }

    Remove the add_filter line to completely disable wpautop().

Viewing 1 replies (of 1 total)
  • The topic ‘spacing after p tag’ is closed to new replies.