jQuery(document).ready(function($){ $('#upload-btn').click(function(e) { e.preventDefault(); var image = wp.media({ title: 'Upload Logo', // mutiple: true if you want to upload multiple files at once multiple: false }).open() .on('select', function(e){ // This will return the selected image from the Media Uploader, the result is an object var uploaded_image = image.state().get('selection').first(); // We convert uploaded_image to a JSON object to make accessing it easier var image_url = uploaded_image.toJSON().url; // Let's assign the url value to the input field $('#logo-image').val(image_url); }); }); $('.color-pick').wpColorPicker(); });