Share This Story, Choose Your Platform!

1. Introduction

Think of your local server as a playground. This is the place where you can test new ideas without the risk of breaking anything important. Even the smallest personal blog will have a theme or plugin that could cause compatibility issues or even site failure when updated. As a developer, it can be difficult to test updates or new features on a live server. If something goes wrong, it could damage your reputation with the site owner and in some cases, even lead to a loss of income. Using a local server to replicate the live environment means you can identify and fix these problems without anyone else ever knowing they happened. Any changes made on the local server can then be carefully replicated on the live server with confidence.

Setting up a local environment for WordPress is an essential task if you want to get into WordPress development. A local server allows you to build and test WordPress themes, plugins, and custom functionality right on your computer rather than on a live server. The goal with this book is to provide a comprehensive guide to setting up a customized local development environment. This might sound like hard work, and in some cases, it can be quite complex. However, getting this environment just the way you want it can make the actual development work much easier later on. It should also be noted that there is no such thing as the “correct” local development environment. My aim is simply to provide information on the available options and the pros and cons of each one. In reality, you may need to experiment a bit and do some research to find out what setup best suits your needs.

1.1. Why is a local setup important?

We often ask this question: why do I really need a local setup for WordPress? I already have a good host, and this would just add to my existing costs. Or someone else might say that they are comfortable with coding on their server. It ultimately comes down to the fact that having a local server gives you an environment which you can experiment with. Many times, changes made to a live server can result in downtime. This could be a problem for an individual running their blog or website using WordPress. Those in the business of web design/development are always looking to add a new feature or improve their site’s functionality. The last thing you want to do is break your client’s website. With a local server, you can never break anything. Local servers also do not require an internet connection. Those who travel frequently may not have access to the internet but still need to code. A local server provides a solution. The strongest reason for setting up a local server is just to keep it local. Your computer is the server. Everything from files to the database is stored within your PC. This means there is no need for connecting to a server through an FTP client to transfer files. This is especially useful when working off a laptop. Connections to internet servers may vary. Sometimes the internet connection is stable, and sometimes it cuts out. An unstable or lost connection while transferring files could potentially damage the file. This would not occur in a local environment.

1.2. Benefits of mastering WordPress local setup

This section should be interesting to intermediate developers and designers who already understand the WordPress platform. If you’re not already comfortable with things like setting up a WordPress site, editing WP files, and creating databases, local development may be a bit too advanced to start with. If that is the case, we recommend becoming familiar with the WordPress Codex and spending more time using WordPress before attempting to make the switch to developing locally.

Learning and mastering the skill of developing WordPress websites on a local server can have many benefits attached to it. Local development is the process of building a website, or web project, in a local environment (your own computer) as opposed to on the internet. Local development has always been the domain of the most advanced developers as it requires a certain level of confidence and technical knowledge. This guide aims to make the journey into WordPress local development as simple as possible and there are a few reasons why we believe you should invest the time to learn these new skills.

2. Setting up a local development environment

So now you have weaves of a locally hosted server ready to scratch your WordPress itch, but not just yet. Before we can begin with WordPress, we must configure WAMP to ensure that everything runs as smooth and hassle-free as humanly possible. Find the WampServer icon, the default location is on your desktop. At the time of writing, the icon is a traffic light. More colours to follow… Now click on the icon, navigate down to PHP and select PHP settings. The only thing you need here is a tick next to PHP error reporting. Ensure that it is on. Next look at the Apache dropdown menu and navigate to Apache modules. This process involves a bit of trial and error as the various modules and configurations can have unexpected results if not selected correctly. We are concerned with pretty URLs so scroll down to find the Apache module mod_rewrite. Ensure this is checked.

Once you have downloaded the WAMP server executable, you can begin the installation. Choose yes at the windows security prompt that follows shortly. At the next screen you will be asked to select your language, this is the last time you will understand anything you read on the installation so choose wisely. Select “I accept the agreement”, then click next until you reach the “select destination location” screen. You can change where WAMP is installed but for the sake of ease, we recommend you keep it as it is and click next. You will then be asked to select the start menu folder, do the same again and click next. Keep all components selected and select the default MySQL settings when you get to it and click next until you begin the installation. Allow the installation to run, you will be asked to select a browser, choose your preferred browser and select open. When asked about setting as default browser click “no”.

Starting from the top, before you can do anything even approaching “WordPress”, you need a local server software installed on your computer. We are going to use WAMP in this tutorial because it is available for both Windows and Mac OS. WampServer is a Windows web development environment. It allows you to create and manage web applications with Apache2, PHP and a MySQL database. It also comes with PHPMyAdmin and SQLiteManager to easily manage your databases.

2.1. Installing a local server software

No need to be alarmed at the amount of options to choose from. The software choices given above are the best choices for those running Windows, with XAMPP and WAMP being simple to install and suitable for newer developers. For those who are confident in installing software and configuring the server, MAMP is a popular choice for Mac users. It’s the same as XAMPP, but we won’t be covering it in this guide. Follow the link provided or continue on with this guide that will cover basic server configurations and installation of XAMPP.

When it comes to choosing a local server to work with, there are a few best picks. PHP is a server scripting language and a powerful tool for making dynamic and interactive web pages. PHP works well with three popular databases. It’s a good idea to install and enable your choice of the database before testing your WordPress installation. The following servers are the best selections for setting up a local environment to work in.

2.2. Configuring the server software

The entry here is determined by the line above it. If you don’t want to use a port number at the end of an address, then the entry on this line should be ’80’. If you are using a different port number, then change the entry on this line to the port number.

The default for XAMPP is ’80’. You can change this to any port number you like. This will be the new address of your localhost. However, there is one more line you especially don’t want to overlook. Further down in the file, you will find a line that reads:

To change the port that Apache uses, you will need to locate the ‘httpd.conf’ file in the ‘apache’ sub-directory of your XAMPP installation directory. Common places for this directory are ‘C:xamppapacheconf’ and ‘C:xamppapacheconf’. Find this line:

Now that we have a local server installed on your computer, it’s time to configure it. Open the XAMPP Control Panel that we installed by launching the ‘control’ file in your XAMPP installation directory. You will see that the Apache and MySQL modules have action links to start them. If the modules do not start on clicking the links, this is likely because some other services are using the ports that XAMPP requires. Apache uses port 80 and MySQL uses port 3306. You will need to free these ports by closing the services using them or by configuring the modules in Apache and MySQL to use different ports.

2.3. Creating a local database

The modifications are inserting the data you got when you created the database where it says `database_name`, `username`, and `password`. Some plugins require other information in wp-config.php. If this is the case, you will be prompted to enter it when you try to use the plugin.

“`php // ** MySQL settings – You can get this info from your web host ** // /** The name of the database for WordPress */ define(‘DB_NAME’, ‘database_name’); /** MySQL database username */ define(‘DB_USER’, ‘username’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘password’); /** MySQL hostname */ define(‘DB_HOST’, ‘localhost’); “`

Now that you have accessed your database, you need to populate your WordPress’s wp-config.php with the correct information. Open wp-config.php in your favorite text editor and modify it:

Accessing MySQL from shell

You will need to know the name of the database you created. The login link to your MySQL admin should also tell you the hostname of your database server (it’s usually ‘localhost’) and your database username. With this information, you are ready to move on. If you have shell access to your server, you can simply type `mysql -u username -p dbname` and then enter your password when prompted.

First, you will need to login to your database. If you are unsure what this means, you probably used phpMyAdmin to create your database. Assuming you have a good host, there will be a link to the database in the control panel. At Dreamhost, this is labeled something like “Manage MySQL”. Click on the link to access your database.

Creating a database can be quite a complex task if you’ve never done it before. It’s not difficult, but the steps involved can be quite intimidating if you are new to development. Thankfully, with your local server now set up, creating a database and user for WordPress is very straightforward.

3. Installing WordPress locally

Step 2) Start LAMP. If LAMP is installed correctly, then you can see a new icon in your Windows tray. It’s normally an icon of two sausages.

Step 1) Install LAMP on your machine. You can install it by using the command “sudo apt-get install lamp-server^”.

If you are using Linux, then you probably are already aware of LAMP. If not, install it.

Step 2) Start WAMP. If WAMP is installed correctly, then you can see a new icon in your Windows tray. It’s normally an icon of two sausages.

Step 1) Download and Install WAMP on your computer. You can download it from here.

If you are aware of WAMP, then creating a company is not a big deal.

Installing WordPress is a really simple process. If you follow the simple steps, the whole process should only take about five minutes. WordPress has really good documentation on installing and upgrading. One thing to note is that it is really useful to have a basic understanding of MySQL.

First and foremost thing to know is what WAMP/LAMP is. WampServer is a Windows web development environment. It can create dynamic web applications. It is a free software created by Romain Bourdon.

3.1. Downloading the WordPress installation files

Return to where you created the new database, and you will notice that there is a new database with the name you specified earlier, most likely on the left-hand side of the page. Select this database, and it will appear empty. It is now the time to import the MySQL file which you should have downloaded earlier. This should import all of the tables and data into your new database.

Now here comes the more interesting part. WordPress tells us to “Create a database for WordPress on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.” Obviously, we have no web server right now, so we will need to bend the rules slightly. This is where the Apache/PHP/MySQL come into play that you installed earlier. By visiting http://localhost/phpmyadmin, you can access your MySQL interface, where you should log in with the default username (root) and password you specified during the installation of XAMPP. By doing this, you have access to the MySQL control panel for your local server. Go ahead and create a new database by typing in a name such as WordPress and pressing create. Next, you will need to complete the second step by downloading and running the “WordPress MySQL user creation script” which is available from [Link]

In this step, you must download the latest version of WordPress from the official site. This procedure is quick and should not take you long. Go to [Link] and download the .zip file, and then use a program to unzip the files in a directory on your computer. A popular program for this is WinRAR, which is available from [Link]

3.2. Setting up the WordPress configuration file

Change this to read: define(‘DB_NAME’, ‘wordpress’) (if you are using XAMPP) or define(‘DB_NAME’, ‘your_database_name’). Last but not least, the file will define the username and password information pertaining to your MySQL user. These are not set the same as the WordPress login ID that you created when installing WordPress. They can be simply defined and are usually defaulted to ‘root’ and a blank password. Step 3 is to save the newly edited file as wp-config.php and close it. Congratulations! You now have a functional WordPress installation on your local system. Let’s move on to the next and final phase of the tutorial.

// The name of the database define(‘DB_NAME’, ‘putyourdbnamehere’);

Start by locating the wp-config-sample.php file and open it using a text editor. You will need to fill in your database information which you should have received when you installed MySQL. If you do not have this information, then you will need to speak to your host. In some cases, it is possible that you would have already set up your database by using a one-click install process through your web host control panel. In this case, you would need to verify its existence and the exact name by going to the control panel and possibly phoning the support line. If you are using XAMPP for the local install, the database should be pre-named as ‘wordpress’. Step 2 is to name the database. This is important as the sample file will read:

The WordPress configuration file, wp-config.php, is one of the most important files in your WordPress installation. This file is located in the root of your WordPress file directory and contains your website’s base configuration details, such as database connection information. When you are performing a WordPress local install for the purpose of testing, you will need to manually edit this file so as to point to the correct database on your system.

3.3. Running the WordPress installation script

If you’ve followed all the instructions to the tee, installing WordPress should be as simple as visiting your website. The first thing you will notice when you visit your site is that it isn’t there. Instead, you will see a message that tells you that WordPress needs a database. Click on the provided link. This will take you to a page with information that tells you the minimum requirements for running WordPress. If you have all the required items, click on the Let’s Go! button. Now you should see a screen that looks like this: Fill in the details of the information that you gathered from creating the database. The table prefix is wp by default. CHANGE THIS. This will make it much harder for a hacker to get into your site. If your database information is correct you will now see a screen that says Run the install. All that’s left is to click the button. Now you should see a license agreement. Click I Agree! Now you should see a screen that asks you to fill in the information for your administrative account. Fill in your blog title, choose a username and enter a password twice. Enter an admin email and click Install WordPress Now. If everything goes alright, you will see a screen that says Success! and gives you information to log in to your site. Click the provided Log in button, enter your username and password and now you have a fully functioning WordPress installation.

3.4. Configuring the WordPress site settings

Table Prefix for WordPress site. It’s good to have a different table prefix for every application you run in a single database, but even if you only configure WordPress, it’s good to change the prefix for security reasons. Change the value $table_prefix=’wp_’; to a certain prefix, such as $table_prefix=’wp_a_’;. Then the table name becomes like $table_prefix.’posts’, making it more complicated to predict the table name.

define(‘DB_NAME’, ‘database_name_here’); – change it to your database name. define(‘DB_USER’, ‘username_here’); – modify it with the database user. define(‘DB_PASSWORD’, ‘password_here’); – modify it with the database password. define(‘DB_HOST’, ‘localhost’); – you’ll need to use something other than mysql to have it functioning, possibly due to server limitations for the web hosting package. For this instance, there are more specific instructions for the $dbhost value, such as “dbhost:/path_to_mysql_socket” or “dbhost:3307”. You need to get in touch with your server system administrator or web hosting provider to make sure of the DB_HOST value. But in many cases, you don’t need to change the value, especially if you are using a computer locally.

From the ‘wp-config-sample.php’ file, open it in a text editor and search for “localhost” or “localhost” or “mysql” – the following characteristics need to be modified:

Want to know why WordPress Local is essential? Then read this artiles: Why is WordPress Local Essential for Your Website Development

4. Mastering local development workflows

This section of the guide aims to be one of the most important and thought-provoking, yet it should be fairly straightforward. Developing and testing themes locally may seem like it requires quite a bit of effort at first, however, it is a skill that is essential to learn for any serious WordPress developer. Version control is a topic that is often overlooked by many WordPress developers. It is not necessarily a specific WordPress topic, however, it is something that is extremely useful for people who are developing WordPress sites. Many people struggle with setting up a development and testing server, or at least having a safe environment to test new plugins or themes. While this is outside the scope of this article (for now), using WordPress’ own built-in functions and/or symlinks to shift your install around is a decent solution for more experienced developers.

4.1. Developing and testing themes locally

Consider testing themes as equivalent to litmus testing before full-scale deployment. It’s a relatively common scenario to have a production WordPress site that’s currently running a live theme. Your WordPress site is using the Kubrick theme. You’ve now been tasked with redesigning and modifying the CSS for an existing theme. You are a smart developer and understand the perils of modifying a live site. What if you totally screw up the CSS and the design is no longer usable? What if there are PHP errors? These are all things that you don’t want affecting your live site. So instead, you decide to work on the theme locally. The setup for testing a theme will vary depending on the developer and the complexity of the theme. But the simplest scenario is that the theme is located in a folder within wp-content/themes/. The theme consists of at least a stylesheet and index.php file. The theme may also have a number of PHP template files and possibly some extra CSS files. Testing a theme can also be done on a fresh WordPress install with example content to see how different areas of the theme perform. The local theme files can just be zipped up and emailed to the client with instructions on how to install it. A wise move for the developer would be to document the testing process. Not just documentation on what needs to be tested, but documentation on what has been changed and the effect that each change had. This will aid the development of the theme and will also aid future maintenance of the theme. This is a scenario where a developer could utilize version control for the theme. Using the WordPress XML-RPC post API, it’s possible to post content to the WordPress install on the client’s server. This can automatically generate example content. The theme can then be installed, and the example content will provide a good simulation of how the theme will perform on the live site. With the recent addition of WordPress custom post types, it may be necessary to further test the theme by creating functional custom post type content. All of this is very achievable to do on a local site without running the risk of affecting the live site. The theme files and client/server simulations can all be done on a local install.

4.2. Using version control for local development

There are two main types of version control, centralized and distributed. I won’t go into too much detail about these, but it is worth noting that WordPress core uses Subversion, which is a centralized type of version control. It’s not essential but is definitely worth considering when working on a plugin or theme for the WordPress community. If you are starting a new project and want to give version control a try, I recommend using Git, which is a distributed type of version control. Although Git is not well suited for use with WordPress core, it is more than capable for managing changes to a plugin or theme. So, given that Subversion won’t be covered here, the rest of this article will assume we are using Git.

Setting up version control is probably one of the most enlightening things you can do to improve your development workflow. When you make changes to a file, a record is created in a special database known as a repository. You can think of the repository as a series of snapshots of your project at any given time. You have the opportunity to create a message explaining the change you made, and who the change was committed by. You also have the ability to revert the file back to any previous state recorded in the repository. Furthermore, using a code repository enables you to view any changes made by date, author, line of code, or a specific revision. This can be extremely useful for debugging.

4.3. Importing and exporting local WordPress sites

What is needed is a solution that is consistent and reliable and that gets around the changing URLs and file paths issues.

At the time of writing this article, I have found that there is no easy solution for reliably backing up, transferring, or duplicating a local WordPress installation. This is mainly due to the fact that local WordPress installations are generated with dynamic URLs and file paths. An absolute file path is hardcoded into the database when images are uploaded into a post. The database is also unreliable for copying and pasting into a new installation since it contains URLs that reference the site of installation, for example, serialized data including widget settings like this: s:35:”http://localhost/testsite/wp-content/themes/twentyten”.

There are several reasons why one might want to transfer their local WordPress installation to another location. For example, you may give a developer a copy of your site to work on, you may want to duplicate the site on another machine you have, or you may be using a local installation as a staging area before moving the site to a live server. On regular sites, transferring WordPress is as simple as moving the files and the database. However, when it comes to local WordPress sites, this proves to be a major headache.


Lechien, Jerome R., Giovanni Briganti, and Luigi A. Vaira. “Accuracy of ChatGPT-3.5 and-4 in providing scientific references in otolaryngology–head and neck surgery.” European Archives of Oto-Rhino-Laryngology (2024): 1-7. [HTML]

Dann, Emma, et al. “Precise identification of cell states altered in disease using healthy single-cell references.” Nature Genetics 55.11 (2023): 1998-2008.

Smith, L. C. “Reference and information services: An introduction.” 2020. [HTML]

Shavkatovna, A. M. “THE INTERTEXTUAL AND INTERCULTURAL REFERENCES IN LODGE’S CAMPUS NOVELS.” American Journal Of Philological Sciences, 2022.

Freitag, M., Grangier, D., and Caswell, I. “BLEU might be guilty but references are not innocent.” arXiv preprint arXiv:2004.06063, 2020. [PDF]

Day, T. “A preliminary investigation of fake peer-reviewed citations and references generated by ChatGPT.” The Professional Geographer, 2023. [HTML]

Almeida, Alexandre, et al. “A unified catalog of 204,938 reference genomes from the human gut microbiome.” Nature biotechnology 39.1 (2021): 105-114.

McKeown, S. and Mir, Z. M. “Considerations for conducting systematic reviews: evaluating the performance of different methods for de-duplicating references.” Systematic reviews, 2021.

Toma, Tiago Shizen Pacheco, et al. “Optimal references for ecological restoration: the need to protect references in the tropics.” Perspectives in Ecology and Conservation 21.1 (2023): 25-32.

Teixeira da Silva, J. A. and Nazarovets, M. “Archiving website‐based references in academic papers: Problems caused by reference rot, potential solutions and limitations.” Learned Publishing, 2023.

Share This Story, Choose Your Platform!