WordPress WP_Media_Image Widget Link Rel

WP_Media_Image widgets support a lot of options, but almost none of them are exposed to the end user. For example, there are toggles for adding target=_blank to the link of a WP Media Image Widget.

Adding this filter to your functions.php will force all WP_Media_Image widgets to link externally without any intervetion from the blog administrators:

function add_blank_target_to_image_widget( $instance, $args, $widget ) {
	$instance['link_target_blank'] = true;
	return $instance;
}
add_filter( 'widget_media_image_instance', 'add_blank_target_to_image_widget', 10, 3 );