I'm getting tons of errors in my error log. Does anyone know how to solve this problem?
They are all the same:
[Mon Jun 27 12:39:xx.518352 2022] [proxy_fcgi:error] [pid 4663:tid 139793920644864] [client 84.80.28.xx:52348] AH01071: Error occurred "PHP message: PHP warning: Invalid " is the parameter provided for foreach() in /home/685947.example.com/public_html/wp-admin/includes/plugin.php on line 1779, reference address: https://example.com/mijn-account/
This is the code (default WordPress file):
function remove_menu_page( $menu_slug ) { global $menu; foreach ( $menu as $i => $item ) { if ( $menu_slug === $item[2] ) { unset( $menu[ $i ] ); return $item; } } return false; }
The value received by the variable ($menu) may not be an array.
It would be fun to add validation, for example:
Variable ($menu) may be an empty array