wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
mv MailHog_linux_amd64 mailhog
chmod +x mailhog
sudo vi /etc/systemd/system/mailhog.service
<?php | |
$file = '/path/to/file.png'; | |
$filename = basename($file); | |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
if (!$upload_file['error']) { | |
$wp_filetype = wp_check_filetype($filename, null ); | |
$attachment = array( | |
'post_mime_type' => $wp_filetype['type'], | |
'post_parent' => $parent_post_id, |
var file_frame; | |
// "mca_tray_button" is the ID of my button that opens the Media window | |
jQuery('#mca_tray_button').live('click', function( event ){ | |
event.preventDefault(); | |
if ( file_frame ) { | |
file_frame.open(); | |
return; |