This is just a quick and easy tip for people who’d like to customize a WordPress theme design while it is live. Using this simple technique, you’ll be able to design, edit and test changes you make to your WordPress site’s currently activated theme without worrying about your visitors seeing your work in progress. The upsides are that you don’t have to set up a complicated development environment and your site experiences no downtime. I use this method all the time when making design changes to both my own and my client’s sites.
Don’t forget to backup any and all files that you plan to edit before you begin!
1. Find the place in your WordPress theme that you want to edit or add code to.
2. Wrap the block of code or area you want to edit with the simple php if statement below, but don’t save your changes yet! It could break your site.
if ($_SERVER['REMOTE_ADDR'] == "") {
// This would be the block of code or area you want to edit
// Don't forget to close out the if statement with the } below!
}
3. Since every computer connected to the internet has a unique IP address, you’re going to use the IP address of the computer you’re working on to set up a work environment that is only visible to you and no one else. So mosey on over to WhatIsMyIP.com and grab your current IP.
4. Paste your IP between the double quotes in that php if statement we inserted earlier. It will look something like this:
if ($_SERVER['REMOTE_ADDR'] == "76.188.215.81") {
// This would be the block of code or area you want to edit
// Don't forget to close out the if statement with the } below!
}
If you’re adding fresh new code to your site (not editing existing code), then that’s it! You’re done. It is now safe to save and start editing.
5. You only need to do this if you’re planning to edit an existing block of code in your WordPress theme. You need to ensure that your theme does not break and the rest of the world will see your site as it currently is. To do that, add an else clause to your php statement then copy/paste the code block you plan on editing into it then save your file. Here is what it will look like:
if ($_SERVER['REMOTE_ADDR'] == "76.188.215.81") {
// This would be the block of code or area you want to edit
// Don't forget to close out the if statement with the } below!
} else {
// This is a duplicate of the original block of code or area you want to edit
// Don't forget to close out the if statement with the } below!
}
That’s all folks! Now whether you’re adding new code or editing existing code, this particular section of your WordPress theme will only be visible to you. You can edit and test your new code until it is ready for release without anyone else ever seeing it.
* Mini-tip: You can further restrict this to a specific page or post by appending “&& is_page()” or “&& is_single()” to your if statement. This should work for all of WordPress’ built-in conditional tags. Here is an example that would only show up on page with an id of 15:
if ($_SERVER['REMOTE_ADDR'] == "76.188.215.81" && is_page(15)) {
// This would be the block of code or area you want to edit
// Don't forget to close out the if statement with the } below!
}
* Remember: Most people have dynamic IP addresses. That means your IP may change from time to time. If you experience problems or are unable to see the code you’re editing, the first thing you should do is go back to whatismyip.com and confirm that your IP address has not changed and matches what you have in your code.

Great idea and I didn’t know about this tip! Here’s a question I’m searching for an answer to (which is how I found your site in the first place). How can you setup a new theme to see what it would like with your current posts and settings (plugins, widgets, etc.) without messing up the current site?
The only way I know how is to set everything up on a subdomain, import pages and posts from current site, add the same plugins and see how it looks from there and customize as needed…but that seems like a lot of work especially since I have a lot of plugins!
Is there another method to do so? Would love your feedback! Thanks in advance!
@Kesha – Email sent with hopefully helpful answers