Created
January 29, 2013 16:17
-
-
Save sosukeinu/4665456 to your computer and use it in GitHub Desktop.
WP function strip *img* from post content *if* post format is *image*
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
<?php | |
// Strip Images from Content if Post Format Image | |
add_filter('the_content', 'strip_images',2); | |
if ( has_post_format( 'image', $postID )) { | |
function strip_images($content){ | |
return preg_replace('/<img[^>]+./','',$content); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment