Skip to content

Instantly share code, notes, and snippets.


tommcfarlin/touch-example.php Secret

Created Jan 26, 2016
What would you like to do?
[WordPress] Touch a File (Before Creating It)
// Assume that $name is specified earlier in the code
$filename = dirname( __FILE__ ) . "/$name.json";
// If the is able to be touched, we're good to go...
if ( touch ( $filename ) ) {
// We're able to write to the file
} else {
// There was a problem trying to write to the file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment