Creating files and directories using only the WordPress Admin.

It is easy to create a new file or directory for your WordPress plugin or theme. No FTP or shell access is required.  You can do it using the WordPress Admin site and the theme editor.

Simply open your active theme’s function.php file and add the following lines into it:

// Uncomment the line below to create a file.
//touch('wp-content/directory/file-name.php');
// Uncomment the line below to create a directory (second arg is permisions, third is the recursive flag).
//mkdir('wp-content/directory', 775, true);

Save the file and load any page of your front facing site (functions.php runs on every front-facing page load).  If you reload your plugin or theme editor you will see the new file is there ready to be edited.

Thanks to webmechanix for getting me started on this.

Leave a Reply