Hi @srd75, thanks for reaching out!
The Undefined constant "SECURE_AUTH_COOKIE" issue broadly speaking suggests that a plugin or mu-plugin is loading a core WordPress file out of order. It has been known to happen on sites with Yoast installed, but we’re unsure if it’s the cause as the number of overall cases have been low.
Please see a solution that worked for this user, and a little more background/information in my response here: https://wordpress.org/support/topic/php-fatal-error-uncaught-error-undefined-constant-secure_auth_cookie/
It would be interesting to know if the same solution works in your case. A good test would be to try Wordfence as the only enabled plugin and see whether it subsides. If the issue goes away, try enabling your plugins one-by-one until it comes back.
Let me know how you get on!
Peter.
Thread Starter
SRD75
(@srd75)
Hi Peter,
I am not comfortable with:
require_once(__DIR__.’/../../../wp-includes/default-constants.php’);
I am not confident this will grab the right file. Is there a more accurate way to require this file?
Thread Starter
SRD75
(@srd75)
Hi Peter,
I have added that code to production as it worked okay on dev.
However, the original error remains.
Cheers,
Steve
Hi @srd75, thanks for the update.
You could directly point to exactly where “/wp-includes/default-constants.php” resides in your hosting using the full path yourself rather than rely on a traversal type syntax. You can usually see your full paths for other files on the Wordfence > Tools > Diagnostics page for a guideline. Unfortunately, as this is custom code I can’t assist with other specific troubleshooting going forward so it may be worth reaching out to Yoast to see if they are able to confirm whether it’s their plugin loading the file out of order. It is possible that an optimization plugin that you’re using to improve site speed or compress assets loaded to the browser might be doing this instead of Yoast themselves.
You could also try a period of Learning Mode to see if the initial error with redirects not working is due to a block.
Another thought might be to check your PHP/server logs to see whether there’s another error thrown at the timestamps you experience the 500 errors on redirect. This might help us out to see, or perhaps point to another issue that you’re able to resolve. Your host may need to look at these on your behalf, depending on the level of access you’re given on your hosting plan.
Thanks,
Peter.
rather than having us adding custom code, is it possible what wordfence could remedy this by adding something like did_action('plugins_loaded') before trying to use stuff not yet ready in the wp_redirect_status filter? https://github.com/Yoast/wordpress-seo/issues/16918#issuecomment-832643112
Hi, I have same issue (same fatal error) here on a multisite with Wordfence and YOAST Pro enabled. Issue started after switching from PHP 7.4 to PHP 8.0!
I found a workaround – inspired by the link above – to enable Yoast on the single site, not the entire network.
I‘d like to check this code from:
https://wordpress.org/support/topic/php-fatal-error-uncaught-error-undefined-constant-secure_auth_cookie/
but same her:
quote:
I am not comfortable with:
require_once(__DIR__.’/../../../wp-includes/default-constants.php’);
I‘ve contacted support from YOAST. They are aware of the issue and work on it. See the link from above.
thanks
I just ran into this today with WP 6.2. When enabling the ghost plugin in the network, it immediately throws the 500 error reported above. Renaming the plugin was required. Instead of activating the plugin on the network, I enabled it only within one blog and that worked fine.