Call to undefined function is_checkout()
-
Have the latest Turnstile and WooCommerce but randomly get error:
When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.8.3
Active theme: WSL (version 1.0)
Current plugin: Simple Cloudflare Turnstile (version 1.31.0)
PHP version 8.1.34
Error Details
=============
An error of type E_ERROR was caused in line 291 of the file /home/websit10/public_html/wp-content/plugins/simple-cloudflare-turnstile/inc/integrations/ecommerce/woocommerce.php. Error message: Uncaught Error: Call to undefined function is_checkout() in /home/websit10/public_html/wp-content/plugins/simple-cloudflare-turnstile/inc/integrations/ecommerce/woocommerce.php:291
Stack trace:
#0 /home/websit10/public_html/wp-content/plugins/simple-cloudflare-turnstile/inc/turnstile.php(108): cfturnstile_is_block_based_checkout()
#1 /home/websit10/public_html/wp-includes/class-wp-hook.php(326): cfturnstile_failed_text()
#2 /home/websit10/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#3 /home/websit10/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#4 /home/websit10/public_html/wp-content/plugins/simple-cloudflare-turnstile/inc/turnstile.php(47): do_action()
#5 /home/websit10/public_html/wp-content/plugins/simple-cloudflare-turnstile/inc/wordpress.php(20): cfturnstile_field_show()
#6 /home/websit10/public_html/wp-includes/class-wp-hook.php(324): cfturnstile_field_login()
#7 /home/websit10/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#8 /home/websit10/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#9 /home/websit10/public_html/wp-login.php(1534): do_action()
#10 {main}
thrownAI says:
is_checkout()is a WooCommerce function. The Turnstile plugin is calling it before WooCommerce has fully loaded, so the function doesn’t exist yet at that point — causing the fatal error onwp-login.php.It’s random because it’s a timing/race condition depending on how WordPress loads plugins in that particular request.
Report it to the Turnstile plugin author — this is genuinely their bug. They should be wrapping thatis_checkout()call in afunction_exists()check:
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.