The default WordPress will automatically add br or p tags to the shortcode, which may disrupt your original HTML structure and layout.
The reason for this problem is that in the default log content processing flow of WordPress, wpautop (a function that converts carriage returns to p or br tags) runs before Shortcode.So our solution is also very simple. Change their execution order and add the following in the functions.php file of the current topic:
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 12);
Original text:http://blog.wpjam.com/m/solution-to-wordpress-adding-br-and-p-tags-around-shortcodes/
Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!