Required not working with Gutenberg

Support General Required not working with Gutenberg

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #13378
    AleAle
    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' );
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.