Automattic / custom-metadata

A WordPress plugin that provides an easy way to add custom fields to your object types (post, pages, custom post types, users)
https://wordpress.org/plugins/custom-metadata/
193 stars 46 forks source link

Add original value parameter through sanitize function #129

Closed mikeyarce closed 6 years ago

mikeyarce commented 6 years ago

Instead of just passing the $value through the sanitize function, we are now passing $original_value and then setting a value for $new_value within the function.

This helps in situations where you might need to alter the original value in a custom callback and not work with just the new value that might not be sanitized properly.

Example: if we're getting a French date, and it's already sanitized then we're left with a null value. Instead we need to sanitize the original value properly and set the new value that way.

sboisvert commented 6 years ago

lgtm, should we look at the other filters in this file and add the same ability to those?