Support Forum
I am using the latest metabox
Meta Box - Version 5.6.2
Meta Box AIO - Version 1.15.8
Meta Box Group - Version 1.3.13
In my functions.php file (in use for many years now) I have this recurring code (excerpt):
// META BOXES - PERSON META
add_filter( 'rwmb_meta_boxes', 'person_stuff_meta_boxes' );
function person_stuff_meta_boxes( $meta_boxes ) {
$prefix = 'person_stuff_';
$meta_boxes[] = array(
'id' => 'personData',
'title' => __( 'Person Data', 'person_stuff_' ),
'post_types' => array( 'post', 'page' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
// Full Name
array(
'name' => __( 'Full Name with suffixes', 'person_stuff_' ),
'id' => "{$prefix}FullName",
'type' => 'text',
'placeholder' => __( 'John Smith, SM \'84, PhD \'94', 'person_stuff_' ),
),
// Profile pic
array(
'name' => __( 'Profile photo', 'person_stuff_' ),
'id' => "{$prefix}profilePhoto",
'type' => 'plupload_image',
'max_file_uploads' => 1,
),
array(
'type' => 'divider',
),
// Company Logo
array(
'name' => __( 'Company Logo', 'person_stuff_' ),
'id' => "{$prefix}companyImage",
'type' => 'plupload_image',
'max_file_uploads' => 1,
),
Until recently, each instance of plupload_image allowed for an upload field to appear where we could upload an image...one for the person, another for a company logo, etc.
Now, only the first instance of plupload_image works. So in this case, the company logo field only gets the label but no field into which to dump an image.
Here are two screenshots...show how if you reverse the Company Name and Profile Photo, only the first gets the opportunity to upload.
https://mitcio2022.artisanovens.com/wp-content/uploads/2022/04/missingfield.jpg
and
https://mitcio2022.artisanovens.com/wp-content/uploads/2022/04/reordered.png
I have rolled back WP to 5.7.6 and PHP and moved hosting services to test this, but no luck.
Any suggestions?
Hi Christopher,
The field type plupload_image
is deprecated, please use the field type image_advanced
or other image fields like image_upload
to upload images. Read more on the documentation
https://docs.metabox.io/fields/image-upload/
https://docs.metabox.io/fields/image-advanced/
ty! That worked.
In case it helps others, here is the old and new code:
OLD CODE:
// Company Logo OLD CODE DEPRECATED PLUPLOAD_IMAGE
// array(
// 'name' => __( 'Company Logo', 'person_stuff_' ),
// 'id' => "{$prefix}companyImage",
// 'type' => 'plupload_image',
// 'max_file_uploads' => 1,
// ),
NEW CODE:
// Company Logo
array(
'id' => '{$prefix}companyImage',
'name' => 'Company Logo', 'person_stuff_',
'type' => 'image_upload',
// Delete file from Media Library when remove it from post meta?
// Note: it might affect other posts if you use same file for multiple posts
'force_delete' => false,
// Maximum file uploads.
'max_file_uploads' => 1,
// Image size that displays in the edit page.
'image_size' => 'thumbnail',
),