default value not working

Support General default value not workingResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28880
    YumikomYumikom
    Participant

    Hi,

    The fields I created don't show or save the default values ​​quite often.
    The following settings are one of them. Comment out id 'prd_checkbox_new' to see the defaults for the other fields. However, when id p'rd_checkbox_new' is enabled, no other field values ​​are displayed.

    
    'fields' => array(
                array(
                    'name'        => 'NEW label year',
                    'label_description' => '',
                    'id'          => 'prd_new_year',
                    'desc'        => '',
                    'type'        => 'text',
                    'placeholder' => '2021',
                    'std' => '2021',
                ),
                array(
                    'name'        => 'NEW label text',
                    'label_description' => '',
                    'id'          => 'prd_new_text',
                    'desc'        => '',
                    'type'        => 'text',
                    'placeholder' => 'label text',
                    'std' => 'label text',
                ),
                array(
                    'name'          => 'NEW label background color',
                    'id'            => 'prd_new_color',
                    'type'          => 'color',
    
                    // Color picker options. See here: https://automattic.github.io/Iris/.
                    'js_options'    => array(
                        'palettes' => array('#af3333', '#007333', '#006333')
                    ),
                    'std' => '#af3333',
                ),
    
                array(
                    'name' => 'Show NEW',
                    'id' => 'prd_checkbox_new',
                    'type' => 'checkbox',
                ),
            ),
    
    

    Please tell me how to display the default value.

    Thanks and regards,
    Yumikom

    #28885
    Long NguyenLong Nguyen
    Moderator

    Hi Yumiko,

    The default value displays as well with the checkbox field prd_checkbox_new. Screen record https://share.getcloudapp.com/Kou4r6Dm

    Please follow the Debugging Information step here and share full of code that create the custom fields. I will re-check the issue.

    #28886
    YumikomYumikom
    Participant

    Hi Long,

    Thank you Long,

    I split the metabox settings into simpler settings and now the default values ​​are displayed.
    Originally there were a lot of fields.

    I always gave up even if the default value wasn't there. If the same thing happens next time, I will contact you again.

    Best regards,
    Yumiko

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.