WP Simple Pay: Remove Card Terms

/** * @link https://library.wpcode.com/snippet/qor69dxo/ */ add_filter( ‘simpay_payment_element_config’, function( $element ) { $element[‘terms’] = array( ‘card’ => ‘never’, ); return $element; } );Continue reading

Re-route BuddyPress emails through WP Mail SMTP

/* Re-route BuddyPress emails through WP Mail SMTP * * Original doc: https://wpmailsmtp.com/buddypress-activation-email-notifications/ */ // Set BP to use wp_mail add_filter( ‘bp_email_use_wp_mail’, ‘__return_true’ ); // Set messages to HTML for BP sent emails. add_filter( ‘wp_mail_content_type’, function( $default ) { if…Continue reading

Block URLs Inside Text Fields

/* Block URLs inside Single Line and Paragraph Text Fields on WPForms * * Original doc: https://wpmailsmtp.com/how-to-stop-contact-form-spam-in-wordpress/ */ /* * Block URLs from inside form on Single Line Text and Paragraph Text form fields * * @link https://wpforms.com/developers/how-to-block-urls-inside-the-form-fields/ */ function…Continue reading

Emails via two different Postmark streams based on the email subject

/* Emails via two different Postmark streams based on the email subject * * Original doc: https://wpmailsmtp.com/docs/how-to-set-up-the-postmark-mailer-in-wp-mail-smtp/ */ // Conditionally set a Postmark mailer message stream in WP Mail SMTP add_filter( ‘wp_mail_smtp_providers_mailer_get_body’, function ( $body, $mailer ) { if (…Continue reading

Using an Office 365 GCC or DoD email address

/* Using an Office 365 GCC or DoD email address * * Original doc: https://wpmailsmtp.com/docs/how-to-set-up-the-outlook-mailer-in-wp-mail-smtp/ */ function theme_prefix_enable_gcc_high_and_dod_compatibility( $country_code ) { add_filter( ‘wp_mail_smtp_pro_providers_outlook_auth_authorize_url’, function ( $url ) use ( $country_code ) { return str_replace( ‘microsoftonline.com’, ‘microsoftonline.’ . $country_code, $url );…Continue reading

Hide the Email Test Menu Item in Settings

/* Hide the Email Test Menu Item in Settings * * Original doc: https://wpmailsmtp.com/docs/hiding-the-email-test-menu-item-in-settings/ */ add_filter( ‘wp_mail_smtp_admin_get_pages’, function ( $pages ) { unset( $pages[ ‘test’ ] ); return $pages; }, PHP_INT_MAX );Continue reading

Send Site Notifications to a BCC Address

/* Send Site Notifications to a BCC Address * * Original doc: https://wpmailsmtp.com/docs/sending-site-notifications-to-a-bcc-address/ */ function wpms_add_bcc_email_address( $args ) { $bcc_address = ‘bcc: [email protected]’; if ( ! empty( $args[ ‘headers’ ] ) ) { if ( ! is_array( $args[ ‘headers’ ]…Continue reading

Fix the InvalidInternetMessageHeader Error in Outlook

/* Fix the InvalidInternetMessageHeader Error in Outlook * * Original doc: https://wpmailsmtp.com/docs/fixing-the-invalidinternetmessageheader-error-in-outlook/ */ function wp_mail_smtp_modify_header( $body, $mailer ) { if ( ‘outlook’ === $mailer ) { $headers = $body[ ‘message’ ][ ‘internetMessageHeaders’ ]; foreach( $headers as $key => $header )…Continue reading