No custom post fields for Authors and Editors with Guttenberg
- This topic has 8 replies, 2 voices, and was last updated 6 years, 2 months ago by
[email protected].
-
AuthorPosts
-
February 21, 2019 at 11:14 PM #13423
[email protected]
ParticipantHi guys!
We finally updated to Gutenberg editor and found out (with surprise) that metabox.io custom fields aren't showing for Author and Editor roles. Only Administrator can see them. What are we doing wrong?All metabox.io extensions are updated to latest versions
February 22, 2019 at 9:31 AM #13424Anh Tran
KeymasterHi, do you use any conditions for meta box or fields?
I've just tested with Gutenberg and Contributor role and it seems to be fine. Here is my screenshot:
February 22, 2019 at 1:42 PM #13428[email protected]
ParticipantHi!
We use this code to display fields[ 'title' => 'Поля обзоров матчей', 'post_types' => 'post', 'include' => array ( 'category' => [ self::$category_id ], ), 'fields' => [ [ 'name' => 'Состав команды 1', 'type' => 'WYSIWYG', 'id' => 'team_1_players', 'options' => [ 'textarea_rows' => 4, 'teeny'=> true,'media_buttons' => false, 'raw' => false,], ], [ 'name' => 'Состав команды 2', 'type' => 'WYSIWYG', 'id' => 'team_2_players', 'options' => [ 'textarea_rows' => 4, 'teeny' => true, 'media_buttons' => false, 'raw' => false,] ], [ 'name' => 'Прогноз на матч', 'type' => 'WYSIWYG', 'id' => 'game_result_tip', 'options' => [ 'textarea_rows' => 5, 'teeny' => true, 'media_buttons' => false, 'raw' => false,] ], [ 'name' => 'Матч', 'type' => 'post', 'id' => 'event_id', 'post_type' => 'event', ], ], ]
February 22, 2019 at 2:24 PM #13429Anh Tran
KeymasterHi Paul,
I see you use a condition for the meta box. So the post must in a specific category before the meta box appear. Don't forget to refresh the page after publishing. See my video here: http://recordit.co/ukE4SLIQaD
February 22, 2019 at 3:53 PM #13432[email protected]
ParticipantI thought so too, but it only appears for Administrator roles after refreshing the page. Authors, Editors, etc - everybody else can't see it. That is strange but it is so.
By the way - any ideas how to make fields appear at once, without refreshing the page? It was like that with classic editor. You choose a category and new fields appear.
February 22, 2019 at 4:23 PM #13433Anh Tran
KeymasterGutenberg submits posts via Ajax, but the Include Exclude extension that you're using uses PHP to filter the meta boxes. So, it needs refreshing the page.
To make it work without refreshing the page, I'd suggest using Conditional Logic. However, it doesn't work with WordPress's category box yet.
February 22, 2019 at 7:10 PM #13440[email protected]
ParticipantHi Anh!
Thanks for the quick reply, unfortunately it did not help.
After a lengthy search, it turned out that the user had strange meta in the user_meta table.
Like 'closedpostboxes_post','metaboxhidden_post','meta-boxorder_event', 'closedpostboxes_event', 'metaboxhidden_event', 'meta-box-order_post'
Am delete it and now everything work fine
mb you know what is?February 22, 2019 at 7:58 PM #13441Anh Tran
KeymasterOh, I got it. These user meta are used by WP to store meta boxes state (visible/hidden) and their order (users can reorder). Looks like Gutenberg doesn't handle these settings properly.
Yes, you can remove them without any problem. Meta Box won't be affected by that.
February 24, 2019 at 4:29 AM #13451[email protected]
ParticipantThat did the trick!
Everything's working fine now, thank you -
AuthorPosts
- You must be logged in to reply to this topic.