Notice: A major release has been issued since this post – Version 2.0

Changing the domain name or URL of a WordPress site can be a very frustrating and time consuming task.

I usually have three development environments that I’m constantly switching between and all of them have completely different domain names.

Server URL
Local http://localhost:8888/myProject
Preview http://myProject.mysite.com
Production http://www.myProject.com

WordPress Domain Changer Screenshot

Fed up with all the steps needed to change the domain I decided it would be worth my time to build a script that could streamline the entire migration process. The first revision of this script was dirty and insecure (to say the least) but it significantly reduced the amount of time spent moving sites between servers and changing their domains.

In a later version I added functionality that allowed the script to read the wp-config.php file and extract DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, and $table_prefix. In addition to this I added five corresponding form fields and auto-populated them with the data parsed from the WordPress config file. This further reduced the amount of time spent setting up and running the domain change script.

When I started working on this latest revision I decided to go in another direction by developing the script into more of a standalone web application. I added simple authentication; better error checking; a console area displaying Errors, Notices, and Actions; and a “session” timeout feature all wrapped in a new user interface.

I’ve also added a mandatory 5 second wait (sleep) during authentication in order to combat the threat of a brute-force attack. However, even with this countermeasure in place it’s very important this script gets removed from the server as soon as the migration process has been completed.

How to Use / Instructions

  1. Backup your WordPress database.
  2. Seriously, Back Up Your Database!
  3. Situation One: You have a new server where you intend to upload your existing WordPress site files.
    1. Export the current WordPress database data into a SQL dump file.
    2. Create a MySQL database on the new server.
    3. Import the WordPress database dump file into the newly created database.
    4. Open up the wp-config.php file and set the DB_HOST, DB_USER, DB_PASSWORD, and DB_NAME constants to the correct values for the new server.
    5. Upload the WordPress directory contents to the domain directory on the new server.
  4. Situation Two: The WordPress files and database locations have not changed — just the domain name.
    • Coninue on to Step 5…
  5. Open up wpdc/config.php file in a text editor and replace the default password with a VERY secure password of your choice.
  6. Upload the entire wpdc/ directory to the root directory of your WordPress site.
    • Note: The root directory is where the wp-config.php is located.
  7. In a web browser go to: http://www.your-new-domain.com/wpdc
  8. Type in the password that you set in step 6 at the authentication prompt.
  9. You will now be presented with the domain changer form.
    1. The script will try and auto-detect all of the settings, but it’s up to you to confirm they are all correct.
  10. Take one last look at the settings to verify that they are correct… then click the “Change Domain!”” button.
  11. Go to your site’s home page at the new domain — all should be working!
  12. Once the domain has been changed remove this wpdc/ directory from the server!

License

This class and its code is released under the New-BSD License.

Requirements

  • PHP >= 5.0, with the MySQLi Extension enabled.
  • WordPress >= 2.8.0
    • Untested on previous versions

Download

The source code is available to anyone at http://github.com/veloper/WordPress-Domain-Changer.

If you’ve found an issue, improvement, or bug with this script please contact me or leave a comment.

During the hours between 11:30 PM and 8:00 AM – while attempting to wrap my head around the development process of a WordPress Plugin – I found myself developing this fun, yet semi-useless, plugin that allows for the on-the-fly translation of plain text into “leet speak.”

Usage

Translation of a post’s text into leet speak can be accomplished by using one of the following methods.

With the first approach one can target specific parts of their post and translate them using the [leet] and [/leet] tags.

The second method allows for the translation of an entire post into leet speak by setting a Custom Field of leet = 1.

Examples

Here are just a couple examples…

  • Open => 0|*3/\/
  • Apple => @|*|*13
  • This is an example. => 7]-[!5 !5 @/\/ 3><@|V||*13.

and, of course, Leet => 1337

Administration Panel

I’ve taken advantage of WordPress’ core wp-option form creator/handlers to bring this plugin one step further by making each character fully customizable. I’ve also included “suggestions” with some of the most common alpha character to leet speak conversions.

Leet-Speak Plug-In Administration Panel

More Information

As it turns out there are many different leet speak character translations; For more information check out the Leet Speak Wikipedia Article.

License

This plugin is released under the New-BSD License.

Download

The source code is available to anyone at http://wordpress.org/extend/plugins/leet-speak.