Use Single Tenant With the Outlook Mailer

/* Use Single Tenant With the Outlook Mailer * * Original doc: https://wpmailsmtp.com/docs/using-single-tenant-with-the-outlook-mailer/ */ add_filter( ‘wp_mail_smtp_pro_providers_outlook_auth_authorize_url’, function ( $url ) { $tenant_id = ‘my_tenant_id’; return str_replace( ‘/common/’, “/{$tenant_id}/”, $url ); } ); add_filter( ‘wp_mail_smtp_pro_providers_outlook_auth_access_token_url’, function ( $url ) { $tenant_id…Continue reading

Set a Custom Email Header

/* Set a Custom Email Header * * Original doc: https://wpmailsmtp.com/docs/setting-a-custom-email-header/ */ function wpmsmtp_custom_mail_header( $args ) { if ( ! is_array( $args[ ‘headers’ ] ) ) { $args[ ‘headers’ ] = explode( “\n”, str_replace( “\r\n”, “\n”, $args[ ‘headers’ ] )…Continue reading

Allow Other WordPress Roles to Manage Email Logs

/* Allow Other WordPress Roles to View Email Logs * * Original doc: https://wpmailsmtp.com/docs/allowing-other-wordpress-roles-to-view-or-manage-email-logs/ */ add_filter( ‘wp_mail_smtp_pro_emails_logs_logs_get_manage_capability’, function (){ // Change this to any other capability of your choosing. return ‘manage_options’; });Continue reading

Allow Other WordPress Roles to View Email Logs

/* Allow Other WordPress Roles to View Email Logs * * Original doc: https://wpmailsmtp.com/docs/allowing-other-wordpress-roles-to-view-or-manage-email-logs/ */ add_filter( ‘wp_mail_smtp_admin_area_get_logs_access_capability’, function (){ // Change this to any other capability of your choosing. return ‘manage_options’; });Continue reading

Maintenance Mode

add_action( ‘init’, function() { if ( ! current_user_can( ‘manage_options’ ) && ! is_admin() && ! is_login() ) { wp_die( ‘This website is currently undergoing scheduled maintenance. Please try again later.’ ); } } );Continue reading

Limit Uploaded Image Size

add_filter( ‘wp_handle_upload’, function ( $file ) { $max_width = 1920; $max_height = 1920; // Check if the file is an image. $mime_type = mime_content_type( $file[‘file’] ); if ( strpos( $mime_type, ‘image’ ) === false ) { return $file; } //…Continue reading