Last active
October 24, 2021 21:37
-
-
Save rfmeier/c048ee02a833593fd2dd to your computer and use it in GitHub Desktop.
Sanitize callback for WordPress register_meta() function.
This file contains hidden or 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 //* do not include php tag | |
/** | |
* Callback for WordPress register_meta() sanitize parameter. | |
* | |
* Sanitize the 'sample_count' meta value before saved to the database. | |
* | |
* @see https://codex.wordpress.org/Function_Reference/register_meta | |
* | |
* @uses absint() | |
* @see https://codex.wordpress.org/Function_Reference/absint | |
* | |
* @param mixed $meta_value The meta value. | |
* @param string $meta_key The meta key. | |
* @param string $meta_type The meta type. | |
* @return mixed The meta value. | |
*/ | |
function sanitize_sample_count_meta( $meta_value, $meta_key, $meta_type ) { | |
return absint( $meta_value ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment