Create New Theme File in WP-Admin without FTP

If you are working on a live WordPress site, there might come a time when you would need to upload a new theme file. This is common if you are creating new templates for a WordPress Theme.

No FTP Access

But how would you upload it if you do not have access to the site’s FTP. This is common if you are a freelance WordPress go-to-guy and your client doesn’t want to give you access to an FTP account or maybe they just simply don’t know how to set up an FTP account for you.

You may be tempted to just upload a whole new zip file containing all of the theme files. But this is a tacky way to handle it especially if the WordPress Theme contains more than 200 files and is more than 5mb. But you only need to upload one file right?

WP-Admin Solution

Go to your WordPress theme editor.

Edit the header.php file and add the following code at the very top or the first line.

<?php touch('wp-content/themes/practice-theme/new-file.php'); ?>

Make sure to add it outside any <?php tags otherwise it could cause an error since the code is already wrapped in its own PHP tags.

Save the changes made to the header.php file. Open a new tab in your browser then visit the website. The new file will be created.

You can now remove the code from the header.php.

The code above will create a file named new-file.php in the directory of the Theme which is practice-theme. You should change these two names to suit your needs. For example you can change the directory name to twentyten if that is the theme you are working on, or change the file name to style-extra.css if that is what’s needed.

After the New File is created you can go back to the theme editor and find the newly created file. You can now paste the file’s contents. Don’t forget to save.

WordPress Create New File

The code can be used to create any text-based file like HTML, PHP, CSS, etc…


  • PHP – new-template.php, new-function.php
  • CSS – new-style.css, page-style.css

If you’re uncomfortable with editing theme files, you can always use a plugin to create a new file without needing an ftp access. This one particular plugin mimics an ftp file manager: WordPress WP-Filemanager though it doesn’t seem to work last time I checked.

Share This Post


Add a Comment
  1. That is a rather illogical way of doing things. I Don’t understand why WP is so popular if any good CMS lets you do such a basic function via a click of a mouse. WP is horrifically illogical for in terms of development usability because of things like this. Use Hero Framework instead of WordPress. At least Hero allows you to do this at the click of a button.

    1. I agree, WP should have a better way of handling files on its own. Though right now there are plugins that do that. But an issue like this won’t immediately turn me away from WP. There’s a reason why many people like it and why so many have successfully made a living out of it. A huge community of user and developers have been built around it so if there’s an issue one might have he can easily seek help.

  2. Thanks this totally worked!

  3. this worked for me!!! very helpful

  4. This is beautiful – thank you so much.

  5. Very slick. Thank you for posting.

  6. Hi there, I followed these exact steps but I still cannot find new file created. I have gone to appearance-editor-chosen the theme to view and all looks the same with no additional php file created…. what could the problem be ?

    1. Just tested again and it still works for me. Did you load the homepage after you’ve added the code?

      Post the exact php line you’ve added on the header:
      <?php touch('wp-content/themes/practice-theme/new-file.php'); ?>

  7. Thanks for the solution. It worked for me.

  8. Thanx friend, for ur great code………. 🙂 (y)

  9. Thank you. It’s working..

  10. Thanks, very useful!

Leave a Reply

Please write your comments in english. I delete anything that even remotely resembles spam.

Note: When posting code, enclose it in pre and code tags.
e.g. Add code here