Custom Fields
Re-Envisioned
Support General No custom post fields for Authors and Editors with Guttenberg

This topic contains 8 replies, has 2 voices, and was last updated by  paul.fedorov@gmail.com 7 months ago.

  • Creator
    Topic
  • #13423
    Resolved
    paul.fedorov@gmail.com
    Participant

    Hi 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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #13424

    Anh Tran
    Keymaster

    Hi, 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:

    https://screenshots.firefox.com/TzBA98Ex1xHhhqir/localhost

    #13428

    Hi!
    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',
                        ],
                    ],
                ]
    #13429

    Anh Tran
    Keymaster

    Hi 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

    #13432

    I 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.

    #13433

    Anh Tran
    Keymaster

    Gutenberg 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.

    #13440

    Hi 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?

    #13441

    Anh Tran
    Keymaster

    Oh, 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.

    #13451

    That did the trick!
    Everything’s working fine now, thank you

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.