The problem is with WordPress’s wpautop()
filter.
Here’s what ACF says to do: https://support.advancedcustomfields.com/forums/topic/removing-paragraph-tags-from-wysiwyg-fields/
This is a normal WP behaviour – to turn all new lines into paragraph
tags.To remove this, you can try loading the value without any formatting.
You can do this by providing a ‘false’ for the format parameter in the
get_field / the_field funcions like so:the_field(‘wysiwyg_field’, false, false);
Hope that helps.
So just change your line to:
<?php the_field("sidebar_content", false, false); ?>
Update:
I see further down in that thread they actually say you can just remove the filter with this line:
remove_filter ('acf_the_content', 'wpautop');