PHP Warning: call_user_func() expects parameter 1 to be a valid callback

$this is not defined in the scope of a closure. Change it to:

add_action('add_meta_boxes', function() use ($this) { 
add_meta_box('model', 'Parent', array($this,'parent_meta_box'), 'model', 'side', 'high');
});

Or better separate both and create a real method instead of a closure.

Leave a Comment