Overriding WordPress’ Default Attachment “Link to” Setting

| Tips

With the release of WordPress 3.5 in 2012 and the introduction of the new Media Manager, came  quite a few upgrades and improvements over the old system. Unfortunately, the changes were not without flaws, one of which, depending on your previous settings prior to upgrading can put a huge damper on your workflow. This is the addition of the ‘Link To’ setting for attachments, no longer updating to your preferred or last used setting. This can post quite a problem when inserting many images into a blog post when you don’t want the images to be inserted as a link to the file (which allows easy downloading or saving the image) or it’s ‘Attachment Page’. Because of this we’ve had numerous customers ask how to get around this so they don’t have to change the setting for each and every image they upload.

To save yourself time and the constant headache of having to change this setting manually, just follow the steps below to change the default to your preferred selection. In the future we will be adding an option to our themes to allow you to change this with a click of a button rather than the steps required below.

Step 1: Navigating to the hidden WordPress Options page.

There is a hidden page within the WordPress admin section, that’s only accessible by entering the URL in your browser’s address bar. This is intentional as it is a page that contains a semi-editable list of all of the options in your WordPress database, and changing/editing these values can and will break functionality if you change something that shouldn’t be changed. That said, you should ONLY ever change values on this page when other methods fail. This page can be accessed by going to:


Step 2: Locate the correct option

Once you’ve navigated to the options.php page within your WordPress admin section, scroll down until you see the option “image_default_link_type”, it should look like this:


Step 3: Change the option to your desired setting

There are three different values for this option, they are:

  • blank
  • file 
  • post

Removing any text in the field will set the Link To default to ‘None’ thus inserting images without any link.

File will change the default to link directly to the image file, allowing users to click the image and see it in a new tab/window, easily downloadable. Note that in our themes, if you have image protection turned on, even if you insert an image linking to the file, that link will be removed.

Post will link to the ‘Attachment Page’ in WordPress, which is basically a page that lists the details about your image, i.e. The Title, dimensions, etc.

After you’ve entered (or removed) the value you want to be as the new default for your site, simply scroll to the bottom of the page and hit the Save button. That’s it!