#52117 closed defect (bug) (invalid)
hooks used in wp_mail suddenly stopped seeing constants after update.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Keywords: | ||
| Focuses: | Cc: |
Description
I'm getting this bug after updating to the latest wp version 5.6.
It looks like my templates that used to work on wp_mail calls have broken. Its odd, because I can get my constants that are declared in wp-config.php from my templates, but they don't seem to be recognized within in the pluggable php core anymore. Have a look at the error:
( ! ) Warning: Use of undefined constant SMTP_FROM - assumed 'SMTP_FROM' (this will throw an Error in a future version of PHP) in C:\xampp\apps\wordpress\htdocs\wp-content\themes\porto-child\functions.php on line 27
Call Stack
# Time Memory Function Location
1 0.4016 415752 {main}( ) ...\index.php:0
2 0.4018 417320 require( 'C:\xampp\apps\wordpress\htdocs\wp-blog-header.php' ) ...\index.php:17
3 0.4020 428544 require_once( 'C:\xampp\apps\wordpress\htdocs\wp-load.php' ) ...\wp-blog-header.php:13
4 0.4022 446648 require_once( 'C:\xampp\apps\wordpress\htdocs\wp-config.php' ) ...\wp-load.php:37
5 0.4027 521712 require_once( 'C:\xampp\apps\wordpress\htdocs\wp-settings.php' ) ...\wp-config.php:109
6 0.8790 50953056 do_action( ) ...\wp-settings.php:568
7 0.8790 50953432 WP_Hook->do_action( ) ...\plugin.php:478
8 0.8790 50953432 WP_Hook->apply_filters( ) ...\class-wp-hook.php:311
9 0.9003 51087008 WC_Form_Handler::checkout_action( ) ...\class-wp-hook.php:287
10 0.9017 51333928 WC_Checkout->process_checkout( ) ...\class-wc-form-handler.php:369
11 1.2388 52568184 WC_Checkout->process_order_payment( ) ...\class-wc-checkout.php:1171
12 1.2393 52568560 WC_Gateway_COD->process_payment( ) ...\class-wc-checkout.php:959
13 1.2479 52577192 Automattic\WooCommerce\Admin\Overrides\Order->update_status( ) ...\class-wc-gateway-cod.php:326
14 1.2583 52562072 Automattic\WooCommerce\Admin\Overrides\Order->save( ) ...\class-wc-order.php:333
15 1.2797 52628984 Automattic\WooCommerce\Admin\Overrides\Order->status_transition( ) ...\class-wc-order.php:221
16 1.3707 52677736 do_action( ) ...\class-wc-order.php:372
17 1.3707 52678112 WP_Hook->do_action( ) ...\plugin.php:478
18 1.3707 52678112 WP_Hook->apply_filters( ) ...\class-wp-hook.php:311
19 1.3707 52679240 WC_Emails::send_transactional_email( ) ...\class-wp-hook.php:287
20 1.3845 53319584 do_action_ref_array( ) ...\class-wc-emails.php:170
21 1.3845 53319584 WP_Hook->do_action( ) ...\plugin.php:544
22 1.3845 53319584 WP_Hook->apply_filters( ) ...\class-wp-hook.php:311
23 1.3845 53320712 WC_Email_New_Order->trigger( ) ...\class-wp-hook.php:287
24 1.4179 53456800 WC_Email_New_Order->send( ) ...\class-wc-email-new-order.php:98
25 1.4338 53677824 wp_mail( ) ...\class-wc-email.php:653
26 1.4366 53681976 apply_filters( ) ...\pluggable.php:352
27 1.4366 53682384 WP_Hook->apply_filters( ) ...\plugin.php:206
28 1.4366 53683888 set_wp_mail_from( ) ...\class-wp-hook.php:287
If I hard code the smtp creds into my functions.php it works. I've also tested on simple templates with out plugins, but this error message seemed the cleanest since it unequivocally shows the include wp-config.php call.
Change History (2)
#1
@
5 years ago
- Component changed from General to Mail
- Focuses template performance removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
#2
@
5 years ago
@SergeyBiryukov - the SMTP_FROM constant is my constant from my config.php file. It seems wp_mail is no longer seeing the constant's from the config.php file. Is wp_mail not part of core? It is unrelated to any plugin. wp_mail calls broke everywhere they were used in my theme regardless of plugins. The only solution was to hardcode all my constants into the functions.php files hooks for wp_mail.
again I posted the woocommerce stacktrace, because it clearly shows the config.php has been specifically included. Stacktraces with a simple core template are much less verbose.
Hi there, welcome to WordPress Trac! Thanks for the report.
The
SMTP_FROMconstant is not used anywhere in WordPress core, so this appears to be a plugin issue. Please note that this Trac is used for enhancements and bug reporting for the WordPress core software, not for third-party plugins or individual support questions.The stack trace shows some functions from the WooCommerce plugin, so I would suggest trying their support forums to resolve this: https://wordpress.org/support/plugin/woocommerce/.