Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Wrap images with figure tag
// Wrap images with figure tag. Courtesy of Interconnectit
if( ! function_exists( 'reverie_img_unautop ' ) ) {
function reverie_img_unautop($pee) {
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '<figure>$1</figure>', $pee);
return $pee;
} /* end reverie_img_unautop */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment