Custom Fields
Support General Unique value of Text field on a whole site

  • Creator
  • #18815
    Resolved Trang Nguyen

    Hi, is it possible to have unique value of a Text field of each post on a whole site (one unique value for each post/custom post type, similar to ID for each post).

    Let say I have a Places custom post type and a Text field called Code.
    For each place, I want to set a code (text+number) in the Code text field and two places can not have a same code.

    Place 1 has code VNSG001
    Place 2 has code VNSG002
    Place 3 has code VNSG003
    If I write VNSG001 or VNSG002 on the place 3 and click Publish/Update, it will show error and ask to change the value that doesn't exist.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #18821
    Long Nguyen


    Unfortunately, the plugin Meta Box does not support to check/validate the value in a field is unique or not. But you can use the post ID of WordPress itself (unique) to concatenate with your field value when printing out on the front end

    echo rwmb_meta('field_id') . get_queried_object_id();

    Trang Nguyen

    Thank for your information!

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