In WordPress, the attachment display settings (right sidebar when trying to insert media) you can choose to either link to a custom URL, attachment page, media file, or none.
Place the following code in your theme’s functions.php file.
//* Set default Attachment Display Settings | |
function mytheme_setup() { | |
update_option('image_default_align', 'left' ); | |
update_option('image_default_link_type', 'none' ); | |
// Set default values for the upload media box | |
update_option('image_default_size', 'large' ); | |
} | |
add_action('after_setup_theme', 'mytheme_setup'); |
If you want the default link action to be none, then change this line
update_option('image_default_link_type', 'none' );
The options you can change that to are:
- blank
- file
- post
Blank removes the link.
File makes images link directly the image file.
Post links the image to a dedicated URL.