Custom Fields
Re-Envisioned
Support General Required not working with Gutenberg

This topic contains 0 replies, has 1 voice, and was last updated by  Ale 4 months, 4 weeks ago.

  • Creator
    Topic
  • #13378

    Ale
    Participant

    Hello,

    I just noticed that fields that are required stop working when using Gutenberg, once Classic editor is enabled the required functionality works again.

    I tried with this sample metabox.

    function your_prefix_get_meta_box( $meta_boxes ) {
        $prefix = 'prefix-';
    
        $meta_boxes[] = array(
            'id' => 'untitled',
            'title' => esc_html__( 'Untitled Metabox', 'metabox-online-generator' ),
            'post_types' => array('post', 'page' ),
            'context' => 'advanced',
            'priority' => 'default',
            'autosave' => 'false',
            'fields' => array(
                array(
                    'id' => $prefix . 'text_1',
                    'type' => 'text',
                    'name' => esc_html__( 'Text', 'metabox-online-generator' ),
                    'attributes' => array(
                        'required' => 'true',
                    ),
                ),
            ),
        );
    
        return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'your_prefix_get_meta_box' );

You must be logged in to reply to this topic.