Set default WordPress Attachment Display Settings

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.

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.