disable default image linking to itself

When you insert an image by default it creates a link to itself. So this usually results in being taken to a page containing just the image and nothing else, so the user has to click the back button. Not a great user experience in my opinion. So this will get rid of that so that images by default have the link set to “none”.

/* disable images linking to themselves by default */
function wpb_imagelink_setup() {
	$image_set = get_option( 'image_default_link_type' );
	
	if ($image_set !== 'none') {
		update_option('image_default_link_type', 'none');
	}
}
add_action('admin_init', 'wpb_imagelink_setup', 10);