Insert into Post button is missing for certain images

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

Read More

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?

Related posts

Leave a Reply

5 comments

  1. 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.

  2. 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.

  3. 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).

  4. 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 (includesmedia.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' => "tt$send $thumbnail $deleten" );
    

    look around it in includesmedia.php… maybe it easyer than it appear for a newbe in php like me!

    peaaaace out

  5. 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