Support Forum
Support › Meta Box AIO › Critical error on website
Ok. Here is my first question. I am having troubles in oxygen with a couple of group fields. So I moved items out of the group. When I did, site crashed. And here is my error log.
If I enable Metabox AIO -- I cannot access custom fields. Any idea how to clear it?
Specifically, if I enable Meta Box Builder I get There has been a critical error on this website. Please check your site admin email inbox for instructions.
Learn more about troubleshooting WordPress.
[24-Aug-2023 18:27:00 UTC] PHP Fatal error: Uncaught TypeError: array_reduce(): Argument #1 ($array) must be of type array, null given in /home/igdev/public_html/wp-content/plugins/oxygen/component-framework/includes/metabox/oxygen-metabox-integration.php:585
Stack trace:
#0 /home/igdev/public_html/wp-content/plugins/oxygen/component-framework/includes/metabox/oxygen-metabox-integration.php(585): array_reduce(NULL, Array)
#1 [internal function]: OxygenMetaBoxIntegration->add_button(Array, Array)
#2 /home/igdev/public_html/wp-content/plugins/oxygen/component-framework/includes/metabox/oxygen-metabox-integration.php(585): array_reduce(Array, Array)
#3 [internal function]: OxygenMetaBoxIntegration->add_button(Array, Array)
#4 /home/igdev/public_html/wp-content/plugins/oxygen/component-framework/includes/metabox/oxygen-metabox-integration.php(108): array_reduce(Array, Array, Array)
#5 /home/igdev/public_html/wp-includes/class-wp-hook.php(310): OxygenMetaBoxIntegration->init_dynamic_data(Array)
#6 /home/igdev/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#7 /home/igdev/public_html/wp-content/plugins/oxygen/component-framework/includes/oxygen-dynamic-shortcodes.php(18): apply_filters('oxygen_custom_d...', Array)
#8 /home/igdev/public_html/wp-includes/class-wp-hook.php(310): Oxygen_VSB_Dynamic_Shortcodes->init_custom_dynamic_data(Object(WP))
#9 /home/igdev/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
#10 /home/igdev/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#11 /home/igdev/public_html/wp-includes/class-wp.php(796): do_action_ref_array('wp', Array)
#12 /home/igdev/public_html/wp-includes/functions.php(1335): WP->main('')
#13 /home/igdev/public_html/wp-blog-header.php(16): wp()
#14 /home/igdev/public_html/index.php(17): require('/home/igdev/pub...')
#15 {main}
thrown in /home/igdev/public_html/wp-content/plugins/oxygen/component-framework/includes/metabox/oxygen-metabox-integration.php on line 585
Hello,
The error log indicates the issue comes from the plugin Oxygen builder. You can deactivate this plugin and try to edit the field group again.
Hi Ben,
Ever managed to fix this issue? I'm running into the exact same problem after moving items outside of a group.
I did fix it...I ditched metabox and went to ACF. Never looked back. I had more troubles with metabox in the short time I used it then I have ever had with ACF.
Metabox completely broke my site. And from the beginning, it did nothing but give me trouble.
When using the Meta Box settings page plugin with WordPress, a critical error may occur due to saving fields without specifying values. This can lead to a fatal error when the count() function is called on a null value within the Manager.php file of the plugin. The problem I believe occurs because the code is trying to count something that isn't there, leading to a crash.
Error frontend: There has been a critical error on this website.
Learn more about troubleshooting WordPress.
Error backend: Warning: Undefined array key "fields" in /home/directory/public_html/wp-content/plugins/mb-core/vendor/meta-box/mb-settings-page/src/Customizer/Manager.php on line 36
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/directory/public_html/wp-content/plugins/mb-core/vendor/meta-box/mb-settings-page/src/Customizer/Manager.php:36
For temporary purposes, I switched the function to:
private function change_input_file( &$field ) {
$field['type'] = ( $field['type'] === 'file' || $field['type'] === 'image' ) ? $field['type'] . '_advanced' : $field['type'];
if ( 'group' === $field['type'] && isset($field['fields']) && is_array($field['fields']) && count($field['fields']) > 0 ) {
array_walk( $field['fields'], [ $this, 'change_input_file' ] );
}
}
You will need shell access and wp-cli, this was only because I could not get in at all, nor could I deactivate the plugin within the shell with wp-cli, after you are back in, then just delete the issue within the GUI, insert the original private function back, and your back, hopefully, this can help someone in the future.
Here is the private function within the backticks format
private function change_input_file( &$field ) {
$field['type'] = ( $field['type'] === 'file' || $field['type'] === 'image' ) ? $field['type'] . '_advanced' : $field['type'];
if ( 'group' === $field['type'] && isset($field['fields']) && is_array($field['fields']) &&
count($field['fields']) > 0 ) {
array_walk( $field['fields'], [ $this, 'change_input_file' ] );
}
}