• Hi, in 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. How can I make a default for this so that every time I upload an image it links to the media file? In other words, how can I set a default setting for the ‘Link To’ in the attachment display settings??

    Help is very, VERY appreciated!! Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • https://www.adamstruve.com/2013/02/how-to-set-default-attachment-display-settings-in-wordpress/

    How To Set Default Attachment Display Settings In WordPress

    by Adam Struve on February 10, 2013

    I run a couple of image heavy WordPress blogs and have been clicking each image one by one to remove the links on them. Clicking each image seemed like a huge waste of time so I went looking for a solution. Google search results had people making plugins and doing things with jQuery to set href to # and all kinds of weird stuff. The real solution is just to load the hidden WordPress options menu at:

    /wp-admin/options.php

    Scroll down until you see the option “image_default_link_type

    The options you can change that to are:

    1. blank
    2. file
    3. post

    Blank removes the link. File makes images link directly the image file. Post links the image to a dedicated URL that’ll look something like example.com/?attachment=134.

    Now all you have to do is click save after you’ve set image_default_link_type to what you want. Pretty simple right? If you were attempting to code a plugin or looking for a javascript solution… STAHP! ??

    Hi,

    The solution that alexbestoloci made would work, but it concerns me that with every WordPress upgrade you did, those options would be overwritten. Here’s what I did that worked great with WP 3.5.1 and would stay after an upgrade.

    Place this in your theme’s functions.php file.

    function mytheme_setup() {
    	// Set default values for the upload media box
    	update_option('image_default_align', 'center' );
    	update_option('image_default_link_type', 'media' );
    	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' );

    Hope this helps and good luck

    Thanks drsprite, this was useful and what I needed to make the image_default_link_type = none.

    @drsprite I added to my child’s theme functions.php and it worked…Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Insert Media – Attachment Display Settings: set a default’ is closed to new replies.