Skip to content

Instantly share code, notes, and snippets.

@kachi
Last active December 14, 2015 07:58
Show Gist options
  • Save kachi/5054191 to your computer and use it in GitHub Desktop.
Save kachi/5054191 to your computer and use it in GitHub Desktop.
画像のみpタグで囲わない
<?php
function remove_p_on_images($content){
//画像のみpタグで囲わない
return preg_replace('/<p>(\s*)(<img .* \/>)(\s*)<\/p>/iU', '\2', $content);
}
add_filter('the_content', 'remove_p_on_images');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment