Custom Fields
Re-Envisioned
Support General default value not working

  • Creator
    Topic
  • #28880
    Resolved Yumikom
    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #28885
    Long 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
    Yumikom
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.