WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes it's necessary to figure out CSS errors or whatever and then it's great if you have a minimal test page where you just insert the specific code you want to test.

How can I create such an empty test.php? All I could find was this. However, doing so will only create a page that will have the same styling as the page.php one, no?

I suppose I need to put something into my function.php to tell Wordpress that it should create a new template for test.php? How would I do that?

Thanks a lot in advance! :)

share|improve this question
Simplest would be to create your page in the WordPress root directory and name it _test_page.php or something, and simply browse to it directly, http://yourwpsite.com/_test_page.php if WordPress is in the document root, you get the point. Does this solve your problem? – soulseekah Oct 17 '11 at 4:03
up vote 2 down vote accepted

I usually do this for just code (no HTML):

add_action('template_redirect', 'test');

function test() {

    // code goes here


For dealing with HTML I prefer blank theme, set up for testing.

If you want to test in context of existing theme create custom page template, add/remove elements according to your needs and assign to test page.

share|improve this answer
Thank oyu for your answer. I want to mainly test HTML and CSS, so I would just switch to a blank theme instead? Wouldn't it be easier to create a blank test.php in my current theme? Basically I'm looking for the least complicated and fastest option to test HTML/CSS I want to use in my theme. – japanworm Oct 18 '11 at 13:43
@japanworm blank test.php does nothing by itself. If you want to test theme environment you need to load it appropriately. As per my answer custom page template is fitting option for that (unless putting together whole separate theme for debug purposes). – Rarst Oct 18 '11 at 13:56
I think a custom page template is probably closest to what I'm looking for. I'll try it out. Thanks a lot! :) – japanworm Oct 18 '11 at 13:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.