default value not working
- This topic has 2 replies, 2 voices, and was last updated 4 years ago by
Yumikom.
-
AuthorPosts
-
June 14, 2021 at 10:44 AM #28880
Yumikom
ParticipantHi,
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,
YumikomJune 14, 2021 at 12:59 PM #28885Long Nguyen
ModeratorHi Yumiko,
The default value displays as well with the checkbox field
prd_checkbox_new
. Screen record https://share.getcloudapp.com/Kou4r6DmPlease follow the Debugging Information step here and share full of code that create the custom fields. I will re-check the issue.
June 14, 2021 at 1:07 PM #28886Yumikom
ParticipantHi 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 -
AuthorPosts
- You must be logged in to reply to this topic.