WordPress get_the_content losing formatting when emailed

The default email content type is text/plain which does not allow using HTML. Add this to your functions.php file: // use HTML instead of plain text add_filter( ‘wp_mail_content_type’, ‘my_awesome_mail_content_type’ ); function my_awesome_mail_content_type() { return ‘text/html’; } But be warned, different email clients has very different support for CSS rules.. Read more from here. Alternative: If … Read more

Prevent sending emails on user creation in OOP context?

send_password_change_email and send_email_change_email are the filters used for sending the user an email, if they change their password or an account has been created for them. It is not responsible for the “New user registration on your site” mail. The function that does this is wp_new_user_notification(), which is actually one of the pluggable functions. You … Read more

Woocommerce Email attachments not working – file not being attached

Apparently Woocommerce need a local path and not a URL to the file. In order to fix I used this: function attach_order_notice ( $attachments, $email_id, $order ) { // Only for “New Order” email notification (for admin) //if( $email_id == ‘new_order’ ){ $file_path = wp_upload_dir()[‘path’]; $file_name = get_field( ’email_file_attachment’, ‘options’ )[‘filename’]; $attachments[] = $file_path . … Read more

How to change this simple code so that it sends the email notification after payment in WooCommerce?

The hook you’re looking for is “woocommerce payment complete” and it’s triggered once an order has been marked as “complete”. In the function called by that hook, you need to grab all coupons applied to the order, and check if any of them is the one you’re looking for. add_action( ‘woocommerce_payment_complete’, ‘so_payment_complete’ ); function so_payment_complete( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)