I am also seeing this issue and would love to hear the solution. Thanks.
PS: I tried 2 wpautop disabling plugins, but they didn’t make a change to this problem (it did remove other <p> from content as expected). So not an issue with wpautop.
Yeah, I’m not seeing a real solution there. It’s not entirely clear how/where those lines of code need to be added/replaced. I was unable to find this code in any files with “function” in the name.
add_filter('dbem_notes', 'wptexturize');
add_filter('dbem_notes', 'convert_smilies');
add_filter('dbem_notes', 'convert_chars');
add_filter('dbem_notes', 'wpautop');
add_filter('dbem_notes', 'prepend_attachment');
From this link http://wordpress.org/support/topic/plugin-events-manager-remove-from-_eventnotes?replies=4
try adding this line in your theme functions.php remove_filter('dbem_notes', 'wpautop');
Ok, figured it out. Adding that code to the bottom of my themes functions.php file eliminated the extra <p></p>. I’ve since moved it to a plugin I made for conditional placeholders for locations, so I don’t have to worry about a theme update overwriting it. For original poster, you only need to use the following code:
remove_filter('dbem_notes', 'wpautop');
So this isn’t actually going to work after all. Even though this does remove the leading 3 <p><p><p> and closing </p></p></p>, it also removes any <p></p> added by WordPress to the content. Is there anyway to only remove the leading and closing <p> elements? Otherwise I’m forced to re-format hundreds of recurring events.
Your problem is at a theme level.
We add autop to dbem_notes filter because it’s recreating what WP would do to post content, but since we use formats or override content of a page, your theme adds p tags AFTER we do this.
see this for more info on disabling autop on your theme – http://codex.wordpress.org/Function_Reference/wpautop#Disabling_the_filter
What changed between 5.2.9 and 5.3.0 that this has suddenly become a problem? Disabling the wpautop filter is a pretty steep request.
Adding
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
Did nothing.
we haven’t added anything to force wpautop this has been something you’d have to do for a long time now if your theme is forcing this behaviour.
@mtharani,
it might be that your theme is adding it after these two lines are executed.
Try wrapping it e.g. in
function remove_autop_filters(){
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
}
add_action('init','remove_autop_filters');
Hi, I just found this post, and it took me a while to figure out what I was doing wrong.. but this info helped me finding a solution in my case.
In my plugin, I was coding by adding content via the wp content filter like this (for readability purposes):
$content .= '<div id="something">
<span>Hello World</span>
</div>';
return wpautop($content);
This worked (and is pretty)… but added extraneous opening and closing <p>
tags like mentioned above.
Then, it hit me. The wpautop filter is treating my code the exact same way it would if it was entered in the post/page tinymce editor.
By having “breaks” in my code between divs… I was getting <p>
tags.
As soon as I “tightened” my code, all extra <p>
tags went away.
My final code looked like this:
$content .= '<div id="something"><span>Hello World</span></div>';
return wpautop($content);
Or, you could also do it like this (to keep it pretty):
$content .= '<div id="something">';
$content .= '<span>Hello World</span>';
$content .= '</div>';
return wpautop($content);
The bottom line… you cannot have extra spacing in the code when using the wpautop filter.
Hope this helps someone in the future!!