The problem is the following, I use wordpress and make my own theme. I want to make a custom field using carbon fields, into which I can upload a file and after saving the record, this file should be placed in the folder I need, but when I started looking for errors and arranging logs, I found out the following: I fill in the fields and upload the file to my custom field, then click save and in the logs I see a message that the file did not have any data, I started checking and it turned out that he just did not see it, he could not download it from my field. Why is this happening?
add_action('carbon_fields_register_fields', 'crb_attach_post_meta');
function crb_attach_post_meta() {
Container::make('post_meta', __('add a', 'crb'))
->where('post_type', '=', 'post')
->add_fields(array(
Field::make('text', 'crb_g_title', 'title '),
Field::make('text', 'crb_additional_seo_g', 'SEO'),
Field::make('text', 'crb_additional_about_g', 'about'),
Field::make('text', 'crb_additional_c', 'Con'),
Field::make('file', 'crb_g_files', 'load file')
->set_required(true)
->set_help_text('loadfile'),
));
}
add_action('save_post', 'crb_save_post', 10, 3);
function crb_save_post($post_id, $post, $update) {
if (empty($_FILES['crb_g_files'])) {
error_log(" i have file load error");
return;
}
}
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand