Unable to save "0" in the text field

Support General Unable to save "0" in the text field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1836
    jsmjsm
    Participant

    This is working:

    array(
        'name'  => 'Starting value:',
        'id' => "{$prefix}info_starting_value",
        'type'  => 'text',
        'size'  => 60,
        'std'   => "00"
    )

    This is NOT:

    array(
        'name'  => 'Starting value:',
        'id' => "{$prefix}info_starting_value",
        'type'  => 'text',
        'size'  => 60,
        'std'   => "0"
    )

    Tried single quotes, no difference ;(

    This code was working before the last update:
    update_post_meta( $p->ID, 'cstm_info_starting_value', '0' );

    Now it's not working. I am using Meta Box version 4.7.2

    I am using CRON to reset values for many records on a daily basis and now it's not working for some reason.

    Could you tell me any quick fix how to save a zero into a text field in Meta Box? std is not as important, but update_post_meta is. I have tried this:

    $zero = "0"; update_post_meta( $p->ID, 'cstm_info_starting_value', $zero );

    But it doesn't work, but this worked:

    $zero = "00"; update_post_meta( $p->ID, 'cstm_info_starting_value', $zero );

    But I need 0 and not 00 saved in the db for that field.

    Thanks for the info how to solve this problem.

    #1837
    jsmjsm
    Participant

    I have tried to put 0 in the textfield in the WP edit and add area where the textfield is and if I type 0 and click on update, it's removed/escaped and nothing is saved.

    If I type 00 or something else it's saved ok.

    #1838
    jsmjsm
    Participant

    I have tried some older version of Meta Box and 4.6 version is saving and showing 0 without any problem.

    #1853
    Anh TranAnh Tran
    Keymaster

    Let me check it again and get back to you. The 4.7 has a new feature with custom attributes, including the meta value. Maybe it *thinks* the value is empty and doesn't show it.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Unable to save "0" in the text field’ is closed to new replies.