How to run some code as soon as new image gets uploaded in WordPress 3.5 uploade
-
I need to run some code as soon as new images get uploaded in WordPress 3.5 uploader. Here is the code of wp-includes/js/media-views.js (line 529-540)
uploading: function( attachment ) {
var content = this.frame.content;// If the uploader was selected, navigate to the browser.
if ( ‘upload’ === content.mode() )
this.frame.content.mode(‘browse’);// If we’re in a workflow that supports multiple attachments,
// automatically select any uploading attachments.
if ( this.get(‘multiple’) )
this.get(‘selection’).add( attachment );
},
I added alert(‘New image uploaded!’) at the bottom of this uploading function, and the browser alert ‘New image uploaded!’ when new image was uploaded. However I don’t want to hack the core of WordPress, so I’m wondering if there is a way that I can write some code in my theme that can do the same thing? Sorry for my English. Thank you for you attention guys!
- The topic ‘How to run some code as soon as new image gets uploaded in WordPress 3.5 uploade’ is closed to new replies.