Home Forums General Issues Values for select field lost Reply To: Values for select field lost

  • Hi @Stavros

    I would like to clarify some things about the default value of a field, because I believe you do not have any bugs, but just some logic issues with your code.

    A default value is only loaded when creating a new post. If that value is not saved (hidden by conditional logic), the the_field function will not return anything into your theme.

    If you were to save the value (turning off conditional logic), the default value would correctly POST to the save function and the value would be saved to the DB. The the_field function will not display the value.

    If you were to now add in the conditional logic to hide this field in the back end, the value will never be ‘deleted’ from the post and will still remain in the DB. This mean the the_field function will display the value which is hidden in the wp-admin.

    I think you need to take this into consideration with your code and add in some conditional statements that check if the ‘select’ field is ‘a’ or ‘b’.

    I hope that helps.