Skip to content

Instantly share code, notes, and snippets.

@dougwollison
Last active January 21, 2016 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougwollison/b073bd2a733beecb6ede to your computer and use it in GitHub Desktop.
Save dougwollison/b073bd2a733beecb6ede to your computer and use it in GitHub Desktop.
Patch unsupported shortcode tags for WordPress 4.4
add_filter('the_content', function($content){
global $shortcode_tags;
$tagnames = array_keys($shortcode_tags);
$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
// Convert [tagname="mainproperty" to [tagname "mainproperty" (still accessible by $atts[0])
$content = preg_replace("/\\[($tagregexp)=/s", '[$1 ', $content);
return $content;
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment