Last active
June 3, 2016 12:37
-
-
Save luclemo/540da53c19f77c01cd55 to your computer and use it in GitHub Desktop.
Image Functions #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 to remove <p> tags on images | |
add_filter('the_content', 'filter_ptags_on_images'); | |
function filter_ptags_on_images($content){ | |
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); | |
} | |
// function to set default image link to none | |
update_option('image_default_link_type','none'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment