{"id":19007095,"date":"2026-08-31T05:48:50","date_gmt":"2026-08-31T05:48:50","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/fatal-error-on-undefined-function-is_add_payment_method_page\/"},"modified":"2026-08-31T05:48:50","modified_gmt":"2026-08-31T05:48:50","slug":"fatal-error-on-undefined-function-is_add_payment_method_page","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/fatal-error-on-undefined-function-is_add_payment_method_page\/","title":{"rendered":"Fatal error on undefined function is_add_payment_method_page()"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;m getting a fatal error triggered on every page load, not just checkout, which is causing a 500 error on unrelated pages of my site (in my case, a custom job alerts page).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Environment: WooCommerce 11.0.1, PHP 8.3.33<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The error from my debug log:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP Fatal error: Uncaught Error: Call to undefined function PaymentPlugins\\Stripe\\is_add_payment_method_page() in wp-content\/plugins\/woo-stripe-payment\/src\/ContextHandler.php:92<br \/>Stack trace: 0 wp-includes\/class-wp-hook.php(353): PaymentPlugins\\Stripe\\ContextHandler-&gt;initialize() 1 wp-includes\/class-wp-hook.php(377): WP_Hook-&gt;apply_filters() 2 wp-includes\/plugin.php(571): WP_Hook-&gt;do_action() 3 wp-includes\/class-wp.php(838): do_action_ref_array() 4 wp-includes\/functions.php(1352): WP-&gt;main() 5 wp-blog-header.php(16): wp() 6 index.php(17): require()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since ContextHandler-&gt;initialize() is hooked into an action that fires on every front end page load, the fatal error crashes any page, not just WooCommerce pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I checked the plugin files directly and is_add_payment_method_page() is called across several files (ContextHandler.php, RequestContext.php, LinkIntegration.php, wc-stripe-functions.php, and a couple of the gateway classes), but I could not find it defined anywhere within the plugin itself. It looks like it is expected to fall back to WooCommerce core&#8217;s conditional tag of the same name in the global namespace.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am currently using Freesoul Deactivate Plugins to deactivate Woo Stripe Payment Gateway specifically on the affected page as a workaround, which does resolve the crash there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Could you let me know:<\/p>\n\n\n\n<ol>\n<li>Under what conditions is_add_payment_method_page() might not be available when ContextHandler-&gt;initialize() runs?<\/li>\n\n\n\n<li>Whether this is a known compatibility issue with WooCommerce 11.0.1?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Happy to provide more info as required<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks in advance.<\/p>\n","protected":false},"template":"","class_list":["post-19007095","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19007095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19007095\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19007095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}