Created
February 10, 2012 20:38
-
-
Save curtismchale/1792689 to your computer and use it in GitHub Desktop.
remove images from content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sfn_remove_the_images( $content = null ){ | |
global $post; | |
if( $post->post_type == 'post' && !empty( $post->post_content ) ){ | |
$content = $post->post_content; | |
$content = preg_replace('/<img[^>]+./','', $content); | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'sfn_remove_the_images' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment