Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pedrorvidal/01a10aba4dee89a1ce41 to your computer and use it in GitHub Desktop.

Select an option

Save pedrorvidal/01a10aba4dee89a1ce41 to your computer and use it in GitHub Desktop.
<?php
#source http://bavotasan.com/2011/a-better-way-to-remove-images-from-a-wordpress-post/
function remove_images( $content ) {
$postOutput = preg_replace('/<img[^>]+./','', $content);
return $postOutput;
}
add_filter( 'the_content', 'remove_images', 100 );
?>
<?php remove_filter( 'the_content', 'remove_images', 100 ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment