• Hi, guys.

    I have made a plugin for specific site options, like: Logo, Site name, Addresses, Social Media links etc.

    I have 3 image uploaders there: Logo, Pattern and Custom Image. I use the standard WordPress Media Uploader and that works.

    This is the code:

    <input id="upload_header_logo" class="upload_header_logo" type="text" name="upload_header_logo" value="<?php echo get_option('upload_header_logo'); ?>" />
    <input id="upload_logo_button" class="upload_logo_button" type="button" name="upload_logo_button" value="Upload" />

    With this javascript:

    jQuery('.upload_logo_button').click(function() {
    		 targetfield = jQuery(this).prev('.upload_header_logo');
    		 tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    		 return false;
    	});
    
    	window.send_to_editor = function(html) {
    		 imgurl = jQuery('img',html).attr('src');
    		 jQuery(targetfield).val(imgurl);
    		 tb_remove();
    	}

    This works.

    But when I’m on a post or page, I can’t insert images anymore. The Media Uploader appears, I choose an image, click insert, the Media Uploader disappears, but the image is not inserted.

    I tried to disable the plugin, change theme to twentytwelve, back to custom theme, enable plugin, but that didn’t work.

    Anyone an idea?

  • The topic ‘Can't insert image when using media uploader elsewhere.’ is closed to new replies.