Created
September 1, 2015 13:26
-
-
Save richterd/7a8b1a11d0ca9ff7c06c to your computer and use it in GitHub Desktop.
Wordpress open Media Image in new window/tab as default
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
/** | |
* Always set target to _blank | |
**/ | |
add_filter('image_send_to_editor', 'custom_image_send_to_editor', 10, 8); | |
function custom_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt){ | |
$html = preg_replace("/<a/", '<a target="_blank"', $html); | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment