I'm using a basic shortcode to wrap some text in an expandable div. What appears to be happening is that the wpautop is inserting a stray closing paragraph tag at the beginning and a stray opening paragraph tag at the end of the content being wrapped.
Here's how it looks in the editor:
[expandable text="Show Content"]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras fermentum facilisis malesuada. Suspendisse potenti. Aenean dui turpis, ornare in ipsum eget, vestibulum egestas nulla.
[/expandable]
And the rendered HTML:
<div class="expandable"><a href="#" class="expand-link">Show Content</a></p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras fermentum facilisis malesuada. Suspendisse potenti. Aenean dui turpis, ornare in ipsum eget, vestibulum egestas nulla.</p>
<p></div>
This is the shortcode function:
function expandable_content_shortcode( $atts, $content = null ) {
$args = shortcode_atts( array(
'text' => __( 'View More', $this->plugin_slug ),
'linklocation' => 'top'
), $atts, 'expandable' );
if ( $args['linklocation'] === 'top' ) {
$output = '<div class="expandable-content"><a href="#" class="expand-link">' . $args['text'] . '</a>' . $content . '</div>';
} else {
$output = '<div class="expandable-content">' . $content . '<a href="#" class="expand-link">' . $args['text'] . '</a></div>';
}
return $output;
}