i found this but doesn’t work
where i should put this code?
add_action('admin_init', 'redirect_after_media_save');
function redirect_after_media_save() {
global $pagenow;
// when visiting the upload screen, we save the number of attachments
if ( $pagenow == 'media-new.php' ) {
$attachments_before = array_sum((array)wp_count_attachments());
update_option('count_attach_before', $attachments_before);
}
if ( $pagenow == 'upload.php' ) { // we are on media library page
// get attachments count before and after upload
$attachments_before = get_option('count_attach_before');
$attachments_after = array_sum((array)wp_count_attachments());
if (
// there are new files uploaded
( wp_get_referer() == admin_url('media-new.php') && $attachments_after > $attachments_before )
||
// or we have just edited media file
isset($_GET['posted'])
) {
// redirect to desired location
wp_mail('[email protected]', 'subject', 'message', $headers, $attachments );
exit;
}
}
}
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]