Shortcodes 0.1.9

After the latest update of the mnmlWP Shortcodes plugin it turned out that the “fix” messes with some of the WP installations I am currently maintaining. So I decided to look for another solution that handles the theme’s wpautop() issues and came across the following solution:

function mnmlwp_fix_shortcodes($content)
    $array = array (
        '<p>[' => '[',
        ']</p>' => ']',
        ']<br />' => ']'

    $content = strtr($content, $array);

    return $content;

add_filter('the_content', 'mnmlwp_fix_shortcodes', 10, 1);

The code above prevents WP from adding line breaks and paragraphs in front of or after shortcodes. It seems to work really well and doesn’t mess with the WP filter “the_content” and the wpautop() functionality.