Support » Alpha/Beta/RC » image_default_link_type

  • Resolved averyl


    I have image_default_link_type set to ‘file’, but images I upload are linked to the attachment page instead. Don’t we get this option any more in 3.5?

Viewing 15 replies - 1 through 15 (of 28 total)
  • When you upload the image, on the right side is an option to pick what you want the image to be linked to. Is that not working?

    That’s working. What’s not working is the option to set it to the file by default, e.g. by using

    Checked in /wp-admin/options.php and it’s getting set, but it looks like it’s not getting read. Interesting. Works on 3.4.2.

    Yeah it works in 3.4.2. Is there any way to disable attachment pages in 3.5 or in general and link straight to the file without a redirect?

    I’m not sure, so I’m gonna ask up the food chain. It works on the old media uploader, so I’m inclined to think it’s in error.


    I went ahead and made just to cover bases. I don’t know enough about the new media code to be able to poke it myself :/ Just spent 40 minutes eyeing it. I’m going to keep kicking to see if it’s obvious enough for me 😉

    Thanks, I’m glad I’ve been of some help then.
    Kind of annoying though, I’ll try to force it with js or I’ll add a warning to our back end when we update to 3.5.
    If there’s anyone who knows something that totally disables attachment pages (also the drop down?), please let me know 🙂

    Moderator Andrew Nacin


    Lead Developer

    As explained on the ticket, this option never forced anything. It only set a default, and it’s a default that we change per-user.

    You can use set_user_setting( ‘urlbutton’, ‘file’ ) to set a user default.

    That works great, thanks!
    I know it just sets a default, but it would be even more interesting if there was an option to totally disable attachment pages. Now I’m redirecting them all to the files.
    But thanks, this is what I was looking for!

    it seems that in wp-3.5.0 all of this 3 options are not settable anymore:

    update_option('image_default_align', 'none' );
    update_option('image_default_link_type', 'none' );
    update_option('image_default_size', 'large' );

    it is always very useful, to set those 3 options inside the theme functions.php itself, specially for some authors, that do not understand so much about what is a attachment-page or file link and such. those users only click on the default “OK” Buttons 🙁

    same as “averyl” me too, i’d like to know, if there’s anyone who knows something that totally disables attachment pages (also the drop down?), please let me/us know 🙂

    For me the solution Andrew gave works. It sets the option to the media file as default, but it doesn’t remove any attachment pages from older post. I don’t think totally disabling them is possible, but you might want to redirect them all. I use this:

    set_user_setting('urlbutton', 'file' );
    function gg_attachment_redirect() {
    	global $post;
    	if (is_attachment()) {
    		wp_redirect(wp_get_attachment_url( $post->ID ), 301);
    add_action('template_redirect', 'gg_attachment_redirect', 1);

    However, this won’t be a good solution if you need a direct link to the file, like for Fancybox for example.

    Oh and if you need all the images to be aligned the same, just don’t add any css. People will still be able to set the alignment, but it won’t do anything. Maybe override the editor-style css.css as well so people see that it doesn’t work before they post.
    Image default size should also be doable with css, though you keep the original size then. That’s a problem for for really big images… There are a lot of plugins to resize the image before upload.

    Of course, these options were really useful, so I hope we see them again in the next version. I also hope there will be an option to totally disable the attachment pages, because quite al lot of people don’t seem to use them.

    Thanx. Until 3.4.2 i could easily also set the align pull-down to tr.align {display:none !important;}… But this too doesn’t work anymore …

    Basically my idea of a better usability is always NOT to show un-useful or confusing options to the “non-professional” authors.

    So rather then controlling this with CSS (what I also do of course) – i try them not to “let them see” these options or if they already incedently used them, and therefore they are saved – to override them again by update_option (...)

    You can remove these buttons if you create a custom admin.css and add the following:

    #content_justifyfull {
    	display: none;

    To have even more control, add this to function.php:

    function custom_tinymce_options($initArray){
     	$initArray['theme_advanced_buttons1'] = 'styleselect,bold,italic,strikethrough,underline,|,bullist,numlist,blockquote,hr,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker';
     	$initArray['theme_advanced_buttons2'] = 'formatselect,forecolor,|,pastetext,pasteword,removeformat,|,charmap,sub,sup,|,outdent,indent,|,undo,redo';
     	return $initArray;
    add_filter('tiny_mce_before_init', 'custom_tinymce_options');

    Then remove the buttons you don’t want! 🙂

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘image_default_link_type’ is closed to new replies.