Google+ PHP TUTORIALS ONLINE HELP FOR MEDICAL AND PROGRAMMING: 2014-05-18

Monday 19 May 2014

How to Remove the Default Image Link in WordPress?

How to Remove the Default Image Link in WordPress?

you know that when you upload an image to WordPress media library, it creates multiple copies of the image in different image sizes. By default it adds a link to the image file. You can set this default link to none to remove the link, but doing it manually each time you upload an image is a little annoying. It is also annoying for users to click on an image and find the same image on the media page as well. Add this code in your theme’s functions.php file to remove default image link functionnality.

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);