I'm using MetaBox as part of a premium theme.
I have several custom post types where I use MetaBox, and all of them use "file" type fields. These fields include the ajax delete function to remove uploaded files. The way I have used these fields for each CPT is the same.
On two of the CPTs the ajax file deletion works as expected. However, on one CPT I get an alert that pops up saying "Invalid File" when I try to delete files.
I have done some initial troubleshooting, and see what the problem is, but I haven't tried to fix it yet.
In the file inc/fields/file.php there is the following line:
$field = rwmb_get_field_settings( $field_id, array( 'object_type' => $object_type ), $object_id );
If I output the $field variable to a text file for debugging I can see the data on the two CPTs where ajax deletion works, but on the one CPT with the error the $field variable is blank.
I had time to dig a little deeper, and in the code for the rwmb_get_field_settings function there is the following code:
return rwmb_get_registry( 'field' )->get( $key, $type, $args['object_type'] );
It is not returning anything for that one CPT.
Any idea why this would work for two CPTs, but not the third?