Skip to content

Instantly share code, notes, and snippets.

@curtismchale
Created February 10, 2012 20:38
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 curtismchale/1792689 to your computer and use it in GitHub Desktop.
Save curtismchale/1792689 to your computer and use it in GitHub Desktop.
remove images from content
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