Create new WordPress files without FTP access

When you’re working on a new WordPress theme for your new site, or you want to customize one more thoroughly, sooner or later you will have to create a new WordPress file. More often than not, WP modifications will require you to create new files and that means opening an FTP client and logging in before you can make changes.

While it is actually advised to work with files over FTP clients, sometimes you will need a quick access to them without having to log in to your FTP service. For example, you might be working from a computer which doesn’t have an FTP client installed and it would be much faster just to create a new file directly from WordPress.

Actually, creating a file from WordPress isn’t that hard. Since there is no graphical user interface which would allow easy file creation, most users might think it might be impossible or very hard to do. To prove you different, we will now show you how to create a new WordPress file without having to use FTP.

As you should already know, PHP is a very powerful tool which allows you to accomplish pretty much everything when it comes to WordPress. At this moment, we would like to introduce you to the Touch function which sets access and modification time of a file and which can be used to create new files on your server.

In order to create a file, follow these simple steps but be careful not to skip any:

  1. Navigate to Appearance -> Editor
  2. Open header.php file from your theme’s folder
  3. Add the following line of code in header.php:
  4. <?php touch('wp-content/themes/new-file.php'); ?>
  5. Change the path to your file and change the name of your file
  6. Save changes

Now you can find your newly created file on the right side menu. As you imagined, the file is completely empty and waiting for your code.

Warning: After you have created the file, you should delete PHP Touch function from the header. You don’t want PHP to try to execute the code again and again so navigate to header.php and delete the very same function you have written in the 3rd step.

Although this can really be helpful at some times, we suggest using FTP any time you can to avoid unnecessary issues you might come across if editing the file directly from WordPress editor.

We hope this short tutorial was helpful. If you want to learn more about the CMS, we suggest that you check the WordPress basics, get access to our other WordPress tutorials, and don’t forget to browse through our resources that will help you with the blog.

Start Blog Book


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *