Just for my own archive this little snippet that eliminates the bugging layout problems caused by empty paragraph tags the WordPress editor is adding to shortcodes when switching from text- to visual editor or on updating the page.
1 2 3 4 5 6 7 8 9 10 |
add_filter( 'the_content', 'shortcode_empty_paragraph_fix' ); function shortcode_empty_paragraph_fix( $content ) { $array = array( '<p>[' => '[', ']</p>' => ']', ']<br />' => ']' ); return strtr( $content, $array ); } |
Found at Thomas Griffin’s blog. Thanks for that day-saver.