Metaboxes issue
motchju opened this issue · comments
- Themosis Version: dev-master
- WordPress Version: 5.9.1
- PHP Version: 8.1
Description
Metabox is present but empty, as soon as the form is submitted and the validation checked they will be present
Steps to reproduce
Metabox::make('publication', $slug)
->setTitle(_x('Infos', 'metabox', 'textdomain'))
->setPriority('high')
->setPrefix('pu_')
->add(Field::text('date', [
'rules' => 'required|min:3',
'messages' => ['required' => 'Le titre est obligatoire'],
'label' => 'Titre',
]))
->add(Field::collection('rapport', [
'limit' => 1,
'rules' => 'required',
'type' => ['application', 'image'],
'messages' => ['required' => 'Merdi d\'ajouter le rapport']
]))
->add(Field::choice('categorie', [
'choices' => ['News', 'Activité'],
'rules' => 'required',
'label' => 'Catégorie',
]))
->set();
In the Js console I have
TypeError: Cannot read properties of undefined (reading 'data')
at themosis.core.js?ver=8.0.0:1:840372
The request is :
Request URL: http://differdange.greng.lu/wp-api/themosis/v1/metabox/publication?post_id=327
Request Method: GET
Status Code: 301 Moved Permanently
And it's redirected to:
Request URL: http://differdange.greng.lu/publications/?post_id=327
Request Method: GET
Status Code: 200 OK
Expected behavior
Be able to work, not a 301 on the call.
However this is strange, I have several metabox and only the one (publication) is causing an issue. I also tried to change the name, but still the same.
Example of others call that are working just fine
Request URL: http://differdange.greng.lu/wp-api/themosis/v1/metabox/info?post_id=222
Request Method: GET
Status Code: 200 OK
Remote Address: [2a00:1158:5:4f3::]:80
Referrer Policy: strict-origin-when-cross-origin
Request URL: http://differdange.greng.lu/wp-api/themosis/v1/metabox/info?post_id=222
Request Method: GET
Status Code: 200 OK
Remote Address: [2a00:1158:5:4f3::]:80
Referrer Policy: strict-origin-when-cross-origin
Request URL: http://differdange.greng.lu/wp-api/themosis/v1/metabox/champs_libre?post_id=222
Request Method: GET
Status Code: 200 OK
Remote Address: [2a00:1158:5:4f3::]:80
Referrer Policy: strict-origin-when-cross-origin
Request URL: http://differdange.greng.lu/wp-api/themosis/v1/metabox/date?post_id=336
Request Method: GET
Status Code: 200 OK
Remote Address: [2a00:1158:5:4f3::]:80
Referrer Policy: strict-origin-when-cross-origin
Is this still happening on current main
release ?
I wasn't able to replicate the issue on main
branch. Going to close this. Let me know if there is still an error.