Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback,
Hey everyone wondering if I could get some help with this error. I feel that it's a PHP 8.1 thing but I am not 100% sure. This code is something I found and I am molding to fit my parameters. It a metabox repeater field for my portfolio singles page.
This is the error:
Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class Metabox_Constructor does not have a method "show_field_" in /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-content/plugins/cmtdsgn-custom-fields-Apri14/wp-metabox-constructor-class-master/metabox_constructor_class.php:516 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-content/plugins/cmtdsgn-custom-fields-Apri14/wp-metabox-constructor-class-master/metabox_constructor_class.php(412): Metabox_Constructor->get_repeated_block(Array, '', 0) #1 /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-content/plugins/cmtdsgn-custom-fields-Apri14/wp-metabox-constructor-class-master/metabox_constructor_class.php(94): Metabox_Constructor->show_field_repeater(Array, '') #2 /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-admin/includes/template.php(1409): Metabox_Constructor->show(Object(WP_Post), Array) #3 /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-admin/edit-form-advanced.php(711): do_meta_boxes(Object(WP_Screen), 'advanced', Object(WP_Post)) #4 /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-admin/post.php(206): require('/Applications/X...') #5 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/cmtdsgn/wp-content/plugins/cmtdsgn-custom-fields-Apri14/wp-metabox-constructor-class-master/metabox_constructor_class.php on line 516
This is the code that it's pointing at.
// populate block with fields
if(isset($field['fields'])){
foreach($field['fields'] as $child_field['id']) {
$old_id = $child_field['id'];
$child_field['id'] = sprintf(
'%s[%s][%s]',
$field['id'],
($isTemplate ? self::REPEATER_INDEX_PLACEHOLDER : $index),
$child_field['id']
);
$child_meta = isset($meta[$old_id]) && !$isTemplate ? $meta[$old_id] : '';
call_user_func( array($this, 'show_field_' . $child_field['type']), $child_field, $child_meta );
}
}
Posted Dec 22, 2022, 3:36 PM UTC · edited