Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wrap images with figure tag
// Wrap images with figure tag. Courtesy of Interconnectit http://interconnectit.com/2175/how-to-remove-p-tags-from-images-in-wordpress/
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