Created
January 16, 2014 08:29
-
-
Save Santel/8451554 to your computer and use it in GitHub Desktop.
Remove first image in the posts that published before 2014
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
//* Remove first image from posts that published before 2014 | |
function remove_first_image ($content) { | |
if (!is_page() && !is_feed() && !is_home()&& get_the_date('Y')<2014) { | |
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1); | |
} return $content; | |
} | |
add_filter('the_content', 'remove_first_image'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment