Skip to content

Instantly share code, notes, and snippets.

@davidraedev
Last active October 2, 2019 05:21
Show Gist options
  • Save davidraedev/aeffd1a90c9a8f8a2fb661e75880081d to your computer and use it in GitHub Desktop.
Save davidraedev/aeffd1a90c9a8f8a2fb661e75880081d to your computer and use it in GitHub Desktop.
powerpress add upload to metabox
<!-- custom upload button -->
<button id="custom_uploader">upload mp3</button>
<script>
$( "#custom_uploader" ).click( function() {
const send_attachment_bkp = wp.media.editor.send.attachment;
const button = $(this);
wp.media.editor.send.attachment = function( props, attachment ) {
$( button ).parent().prev().attr( "src", attachment.url );
$( button ).prev().val( attachment.id );
wp.media.editor.send.attachment = send_attachment_bkp;
$( "#powerpress_url_podcast" ).val( attachment.url );
setTimeout( function(){
$( "#powerpress_check_podcast_button" ).trigger( "click" );
}, 1 );
}
wp.media.editor.open( button );
return false;
});
</script>
@davidraedev
Copy link
Author

Add around line 206 on powerpressadmin-metabox.php

Auto fills in the url and submits the verify url for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment