• Resolved flammanj

    (@flammanj)


    Is there a way to store and return empty fields as NULL?

    Here is what I tried so far:
    In the admin panel, under additional field options I checked ‘allow empty value’ and tried setting default value to null.

    In the template (using my own template) using the field method I tried using raw_display => true
    but to no avail.

    In every case, the date or time fields get returned as either 00:00:00 or 0000-00-00 or another, random date. What I need is that if the user doesn’t enter a specific date or time, it should return NULL.

    https://wordpress.org/plugins/pods/

Viewing 1 replies (of 1 total)
  • Plugin Author Jim True

    (@jimtrue)

    If you’re saving as a Custom Post Type Pod, you’re writing to MetaData, which means you’re saving the entry as a string to be interpreted from the wp_postmeta table.

    You can’t set the value as NULL because it’s being written out as a text value and interpreted. The format string you’ve defined for the date is what’s writing the 00 date/time values to the Meta string.

    If you need to make sure the field is NULL, you should probably look at either Table Storage or switching to Advanced Content Types and control the field values that way.

Viewing 1 replies (of 1 total)
  • The topic ‘Return blank field value as null’ is closed to new replies.