This field type renders a file picker.


  • formats - an array of the allowed file extensions;

  • multiple - set to true to allow selecting multiple files.


The code below renders a required file picker with the custom_field name and "Custom field" label. It allows selecting multiple JPG, PNG and GIF image files.

echo ( new HivePress\Fields\File(
		'name'     => 'custom_field',
		'label'    => 'Custom field',
		'formats'  => [ 'jpg', 'png', 'gif' ],
		'multiple' => true,
		'required' => true,
) )->render();

Last updated