differentiate type=text and type=taxonomy when using the same id

Support General differentiate type=text and type=taxonomy when using the same idResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #43458
    Hinnerk AltenburgHinnerk Altenburg
    Participant

    given:
    - post_meta field 'city'
    - taxonomy with query_var 'city'

    code:

    [
        'type' => 'text',
        'name' => 'City',
        'id'   => 'city',
        'std'  => '',
    ]

    problem:
    The meta box text field is being filled with the taxonomy term 'city' instead of the post_meta value 'city'.
    When I save the post, the updated value entered into the text field is neither being written to the post_meta 'city', nor a taxonomy term is being created/assigned.

    desired behavior:
    - read and save fields using 'type' => 'text' from post_meta 'city', only
    - read and save fields using 'type' => 'taxonomy' from taxonomy 'city', only

    #43469
    PeterPeter
    Moderator

    Hello,

    If you have two fields with the same IDs on one editing page, the second field value will be saved and the first one will display the value of the second field. It is expected and we've also noted in the documentation https://docs.metabox.io/field-settings/

    ID id Field ID. Required and must be unique.

    You should have different field IDs for text and taxonomy fields.

    #43522
    Hinnerk AltenburgHinnerk Altenburg
    Participant

    Hi Peter,

    thanks, so we're gonna fix it on our side.

    Best regards,
    Hinnerk

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