Skip to content

Instantly share code, notes, and snippets.

@bmsterling
Created May 5, 2011 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bmsterling/957794 to your computer and use it in GitHub Desktop.
Save bmsterling/957794 to your computer and use it in GitHub Desktop.
Removed the paragraph tag that wordpress' wpautop puts around images.
function wpautop_fix( $content ){
$content = ereg_replace('<p[^>]*>(<img[^>]*>)<\\/p[^>]*>', '\\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