This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 7th, 2013  |  syntax: JavaScript  |  size: 0.40 KB  |  views: 117  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         $('.sb-media-btn').click(function() {
  2.             var send_attachment_bkp = wp.media.editor.send.attachment;
  3.             var id = $(this).attr('rel-id');
  4.  
  5.             wp.media.editor.send.attachment = function(props, attachment) {
  6.                 $('#url_' + id).val(attachment.url);
  7.                 wp.media.editor.send.attachment = send_attachment_bkp;
  8.             }
  9.  
  10.             wp.media.editor.open($(this));
  11.  
  12.             return false;      
  13.         });
clone this paste RAW Paste Data