Skip to content

Add ->set_default_value_backend( $default_value ) ->set_default_value_front_end( $default_value )  #559

@BenBroide

Description

@BenBroide

Version

  • Carbon Fields: 2.2
  • WordPress: 4.9.7
  • PHP: 7

Expected Behavior

They should be a way to set a default value for the backend end post screen, and a default value do display in front end (via carbon_get_post_meta or rest api).

Actual Behavior

When you set a default value, if no value in DB the default value will be set in the carbon edit screen and in rest api / carbon_get_post_meta

Comments

The reason:
I have a projects which has a country field, and state field. The country field always has a value, the state field has a value only if country is united states.
The problem happens when I set a default value for a state, for example, if I will set the default state for as "NY", and I will get the fields for a country that is not United states, carbon_get_post_meta will return "NY" for the state field because that is the default value.
If it would possible to set a different default value for the admin edit fields, and a different default value to carbon_get_post_meta that would be great.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions