Opened 15 years ago
Closed 15 years ago
#11650 closed defect (bug) (fixed)
Unable to create empty value for postmeta
Reported by: | dd32 | Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
As posted by John on wp-testers, Post meta doesnt allow for a blank meta value, and simply gives an error of "An unidentified error has occurred."
when attempting to update the value.
Comfirmed on 3.0
Attachments (1)
Change History (10)
#2
@
15 years ago
This seems like a regression, or at least the entire issue was not fixed in the previous bug for custom fields. The unidentified error used to appear when adding a new custom field with no value - that now displays a proper error - now it seems to appear when setting an existing one to a blank.
#4
@
15 years ago
I can't recall to have ever managed to store an empty string as a postmeta. zero works however (or worked, anyway).
(for user meta, only an empty array works. everything else will just get ignored.)
#5
@
15 years ago
I somewhat dont think a empty value has ever been allowed.
In this case, I think the error condition simply needs to be raised on the ajax call.
#6
@
15 years ago
- Keywords has-patch added; needs-patch removed
attachment 11650.dif added
- Adds a Error if you attempt to update meta to a empty value.
- non-empty string is fine
- 0 is fine
- Zero length string is not
- Nor is a whitespace-only string (Meta refuses to add it, which is the reason for the trim())
#7
@
15 years ago
If you try to add a custom field with a valid key value but whitespace in the meta key name itself (Enter New > put spaces in the Name field > put valid input into value field)
Then click Add Custom field Error message is still "Please provide a custom field value." should read ... a custom field name.
If a blank meta value is not allowed, As i suspect, Then the error message either needs to be changed to reflect that, Or updating with an empty value should delete it - In that case, a javascript warning "Warning: Updating this meta value to blank will delete this custom field"