Created
March 26, 2014 17:09
-
-
Save jbutko/9788268 to your computer and use it in GitHub Desktop.
WP, functions.php: Add non-clickable images to post
This file contains hidden or 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
update_option( 'image_default_link_type', 'none' ); | |
function no_atag_on_images($content){ | |
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); } | |
add_filter('the_content', 'no_atag_on_images'); | |
// From http://freakify.com/make-wordpress-images-non-clickable-inside-a-post/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment