• Resolved evangwin

    (@evangwin)


    I had this issue with another plugin and they updated their plugin with this fix:

    Added a sanity check to the woocommerce_account_menu_items hook in case other plugins have altered the parameter type of this WooCommerce hook.

    Is it possible that you could do the same?

    Issue:

    An error of type E_ERROR was caused in line 1047 of the file /home2/ganocclb/public_html/wp-content/plugins/user-switching/user-switching.php. Error message: Uncaught TypeError: Argument 1 passed to user_switching::filter_woocommerce_account_menu_items() must be of the type array, null given, called in /home2/ganocclb/public_html/wp-includes/class-wp-hook.php on line 326 and defined in /home2/ganocclb/public_html/wp-content/plugins/user-switching/user-switching.php:1047

    Stack trace:

    #0 /home2/ganocclb/public_html/wp-includes/class-wp-hook.php(326): user_switching->filter_woocommerce_account_menu_items(NULL)

    #1 /home2/ganocclb/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)

    #2 /home2/ganocclb/public_html/wp-content/plugins/customize-my-account-page-for-woocommerce/includes/AccountMenu.php(133): apply_filters(‘woocommerce_acc…’, Array, Array)

    #3 /home2/ganocclb/public_html/wp-includes/class-wp-hook.php(324): ThemeGrill\WoocommerceCustomizer\AccountMenu->init_default_endpoints(”)

    #4 /home2/ganocclb/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)

    #5 /home2/ganocclb/public_html/wp-includes/plugin.php(5

    • This topic was modified 1 year ago by evangwin.
Viewing 1 replies (of 1 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Thanks for the report. The problem with doing that is it’s papering over the underlying issue and usually just shifts the problem to the next piece of code that’s also expecting an array.

    The root cause here is something on your site is returning null from the woocommerce_account_menu_items filter, which is a programming error. It must return an array of menu items (or an empty array).

    The best thing to do would be to deactivate your other plugins one by one until you find the culprit, and then ask the author of that plugin to investigate the bug.

    Best of luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal Error with woocommerce_account_menu_items hook’ is closed to new replies.