Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I thought I was crazy, but on some of the images in my media gallery, there is no "insert into post" button. see the picture:

enter image description here

this is only for some images though, and the button is there, like it's supposed to be, for the others.

what could be causing this to afflict particular images and not all of them?

share|improve this question
    
yep, happening to me as well. For some reason the "insert into post" button is missing from the media library thick box popup for some files but not for others. It seems pretty arbitrary which files are affected. Tried regenerating the thumbnails using the Regenerate thumbnails plugin, but makes no difference. File size and type doesn't seem to make a difference either –  Ash G Aug 19 '11 at 6:37
1  
have you checked the DOM for the link? maybe its actually there but hidden by css? –  Innate Aug 20 '11 at 17:31
    
It would help that you indicate the WP version, the list of active plugins especially if any of them acts on the admin interface, and, eventually, the them you are using. –  pixeline Aug 22 '11 at 9:58
    
sorry for the lack of helpful comments, but it has been extremely difficult to isolate/reproduce this behavior. –  helgatheviking Aug 23 '11 at 6:06
    
There are no plugins, it happens with even the default theme twentyeleven. Version of WordPress is latest version. There seems to be no rhyme or reason to it and I cannot reproduce it at will. It affects some installations and not others, even though they are identical on the same server and domain. And no, its not hidden via CSS. Otherwise ALL the images would be affected in the same way and not just some of them. –  Ash G Aug 24 '11 at 4:19

5 Answers 5

If you have a post type that doesn't have the editor, uploading media in that post type will cause it to not have an "Insert into Post" button. Not sure if that's your situation, but personal experience says that could be the reason :)

I would definitely disable all plugins and switch to a default theme first to see if one of those is causing a conflict. Absolutely do not modify the core.

share|improve this answer
    
This is happening on regular posts and pages –  Ash G Aug 24 '11 at 4:21

Had the post been saved before your tried to insert the image? I'm pretty sure to insert an image into a post the post needs to have a valid post_id.

share|improve this answer
    
This affects posts saved and unsaved. What is so strange about it is that it will affect one image but not another on the same post. But if an image is affected, its affected on EVERY post –  Ash G Aug 24 '11 at 4:21

I had the same issue, but in my case it was not on an "image" basis, but rather the "Insert into Post" button failed to generate on certain custom post types. In my case -- which I'm not sure it applies -- it had to do with adding a modified TinyMCE editor into a custom metabox (I was using WPAlchemy's MetaBox class), then disabling the default (now redundant) editor, which in turn seemingly told WordPress that the user had no way of inserting images into that post type. Logically, WordPress didn't feel the need to generate the "Insert" button, since it didn't expect images to come by.

My fix was simple, and even though the source of the problem can be different, the solution might be the same. All you have to do is tell WordPress that image insertion should always be allowed:

add_filter('get_media_item_args', 'allow_img_insertion');
function allow_img_insertion($vars) {
    $vars['send'] = true; // 'send' as in "Send to Editor"
    return($vars);
}

If always is too often, just add the filter conditionally (i.e. detecting post type, like I did).

share|improve this answer
    
well i do use WP alchemy all over the place, so this sort of makes sense to me. i'll have to check it out –  helgatheviking Aug 25 '11 at 17:08
    
ah, works beautifully. I was using a custom post type, with a disabled content editor, and several tinymce instances in the meta box. adding the above code fixed it immediately. –  magma Sep 15 '12 at 22:36

think i have found it if that can be any help. did not finished it .. but still gonna continu that tomorrow, time to sleep.

here what was my orginal call

tb_show('', 'media-upload.php?post_id=1&type=image&TB_iframe=true');

that from a button click... jquery. now, i have realize that the wordpress function in media.php (includes\media.php) look if the post id exists. Before, it was working just find with "post_id=1". but now on we HAVE to pass the post id... so my call gonna look like

tb_show('', 'media-upload.php?post_id= < ? php echo Xxxxx ?> &type=image&TB_iframe=true');

(whitout the blank space in aronud the '?')

where xxxxx is replace by my post id... now im new to php so here i am.. going to sleep but hey. it works well when i hardcode it myself with the good post id.

other solution possible:

this is the line that make the button appear:

$form_fields['buttons'] = array( 'tr' => "\t\t$send $thumbnail $delete\n" );

look around it in \includes\media.php... maybe it easyer than it appear for a newbe in php like me!

peaaaace out

share|improve this answer

Never had this problem but after looking around a bit I found something. You might wanna try and go to wp-admin/includes/media.php and change

if ( $send )
                $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";

to

if ( ! $send )
                $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";

however .. don't see this as a permanent fix because editing core files is a bad thing. What you could also do is disable all plugins to see if there is something that conflicts with your wordpress installation

share|improve this answer
1  
Yes, this is not a viable option as it requires editing a core file. –  Ash G Aug 24 '11 at 4:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.