Created
May 16, 2016 08:26
-
-
Save websupporter/c5747176e15441b13a95287c9a13f1f5 to your computer and use it in GitHub Desktop.
Use register_meta to sanitze your meta values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_meta( 'post', 'mein_metakey', 'mein_metakey_sanitize_callback' ); | |
function mein_metakey_sanitize_callback( $value, $key, $type ){ | |
if ( 'post' === $type && 'mein_metakey' === $key ) | |
return (int) $value; | |
return $value; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment