Tutorials, WordPress

Recovering Scratch Files In phpStorm

I love phpStorm. It’s the best IDE for WordPress development, period end of story.

One of its many cool features is the scratch files. I used to have a bad habit of typing up a quick test, or example code in whatever file was last open, promising myself to clean up after myself later. Or, to take advantage of phpStorm’s ability to jump to a function, class, hook callback, etc’s source, by command clicking on it, I’d just type in the function (or whatever) and jump through.

Scratch files are the right place for this sort of thing, as while they actually can be executed, they are not executed as part of WordPress. Until recently, I was under the mistaken impression that once you closed a scratch file it was lost for ever. This made Josh a very sad boy many times.

Turns out I was wrong and you can easily get back to any closed scratch file in a project. All you have to do is click on the dropdown at the top of the file viewer pane, and change form project files, the default to scratches. All your old friends are there! Day == saved.


Docs: https://www.jetbrains.com/webstorm/help/scratches.html

Is this me blogging at my self? Yes, yes it is 🙂


  1. Thanks for this! Saved me today!

  2. Ken Wienecke

    This blog entry just saved not only my bacon but my whole meal. I could not possibly be more relieved. I am as adamantly enthusiastic about PHPStorm as you are, Josh, and you are an outstanding credit to us its userbase. May God bless you for taking a few minutes more than a year ago to post a bit of wisdom that you did not know in advance would prove so critical to me now.

  3. That is an awesome tip! I use scratch files all time with PHP Storm. Before they added scratch file support, I always had to jump over to Sublime to do my scratch work.

Leave a Reply

Theme by Anders Norén