-
-
Save tommcfarlin/77f82db963da726646307a8459dc2500 to your computer and use it in GitHub Desktop.
[WordPress] Quick Tip: Sanitize Post Data in WordPress
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 | |
public function sanitize(string $data): string | |
{ | |
return strip_tags( | |
stripslashes( | |
sanitize_text_field( | |
filter_input(INPUT_POST, $data) | |
) | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment