Last active
February 20, 2017 11:58
-
-
Save jauhari/2db6d6faa7983d3a9097126efaa5f501 to your computer and use it in GitHub Desktop.
Remove Image and wp caption on Content Frontpage WordPress
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 | |
function dhw_remove_img($content) { | |
if (!is_single()): | |
// REMOVE IMAGE ONLY $content = preg_replace("/<img[^>]+\>/i", "", $content); | |
$content = preg_replace("#\s*\[caption[^]]*\].*?\[/caption\]\s*#is", "", $content); | |
endif; | |
return $content; | |
} | |
add_filter( 'the_content', 'dhw_remove_img' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment