wordpresswordpress-theming

Undefined array key 0 in wp-includes/plugin.php line 1001


The problem's origin is not directly related to any 3rd party plugin, but rather to a custom code. The error occurs in the Wordpress core function _wp_filter_build_unique_id: https://github.com/WordPress/WordPress/blob/master/wp-includes/plugin.php#L989

_wp_filter_build_unique_id is used when modifying filters so the cause may be found in eg. add_filter(), has_filter() or remove_filter().

The problem can be mitigated by adding an isset() check but is not advisable. Rather, the root cause for the problem should be fixed.

Wordpress version used: 6.6.1

Disabling plugins didn't make the error disappear, reverting to default theme (Twenty-twenty-one in this case) did.


Solution

  • The problem was calling add_filter() in a wrong way by not passing the second argument as string.

    Fixed by changing add_filter('woocommerce_show_page_title', __return_null()) to add_filter('woocommerce_show_page_title', '__return_null')