25% off ProSNIPC25OFF

Set Default Image Link to None on Insert

Prevents WordPress from automatically wrapping inserted images in anchor tags linking to the attachment page or file.

PHPby SnipCraft
php
<?php
// Stop WordPress from wrapping inserted images in anchor tags by default.
// Existing inserted images are unaffected; only new inserts use 'none'.
add_action( 'admin_init', 'scseed_set_default_image_link_none' );
if ( ! function_exists( 'scseed_set_default_image_link_none' ) ) {
    function scseed_set_default_image_link_none() {
        if ( 'none' !== get_option( 'image_default_link_type' ) ) {
            update_option( 'image_default_link_type', 'none' );
        }
    }
}
#admin#editor#images#links#media