Skip to content

Instantly share code, notes, and snippets.

@laurent-d
Forked from bmsterling/wpautop_fix
Last active February 26, 2017 14:00
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 laurent-d/b00dfc7cf7132f0a423c437934a13508 to your computer and use it in GitHub Desktop.
Save laurent-d/b00dfc7cf7132f0a423c437934a13508 to your computer and use it in GitHub Desktop.
Removed the paragraph tag that wordpress' wpautop puts around images - Php 5.6 > *
function wpautop_fix( $content ){
$content = preg_replace('/<p[^>]*>(<img[^>]*>)<\\/p[^>]*>/i', '$1', $content);
return $content;
}
add_filter('the_content', 'wpautop_fix');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment