1.9.5 sanitizier choice on amount
I think the sanitizer for the field ingredient => amount should be “sanitize_text_field” rather than “intval”.
With the current setting, if I edit a recipe with an amount like “1¼” it gets truncated to “1” in the editing form. Similarly, an amount like “1/3” is shown in the form as “0”. As far as I can tell there’s no good way to enter a fraction with the intval sanitizer.
Adding to the confusion, the sanitizer only applies when the form is displayed and not when it’s submitted. If I type “1¼” and save/publish, the value saved to the databse is “1¼” but when the page reloads the form just shows “1”.
I think it works better like this:
'sanitizer' => array( 'amount' => 'sanitize_text_field', 'measurement' => 'sanitize_text_field', 'ingredient' => 'sanitize_text_field', 'notes' => 'sanitize_text_field' )
- The topic ‘1.9.5 sanitizier choice on amount’ is closed to new replies.