---
title: Develop and Work with WordPress Multisite Locally Using a Production Database
date: 2012-06-19T14:24:42+00:00
modified: 2012-06-27T09:42:15+00:00
permalink: https://kaspars.net/blog/develop-wordpress-multisite-locally-using-production-database
post_type: post
author:
  name: Kaspars
  avatar: https://reverse.kaspars.net/gravatar/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?s=96&d=mm&r=g
post_tag:
  - How to
  - Plugin
  - Snippet
category:
  - WordPress
---

# Develop and Work with WordPress Multisite Locally Using a Production Database

**Update:** This is useful only if you can’t edit your local `/etc/hosts` file (using a tool like [Gas Mask](https://kaspars.net/blog/gas-mask-hosts-editor-for-mac) makes it fast and super easy) and use the production domain for development.

To my knowledge, there was no way to work on a WordPress Multisite network locally while using a production database, so I spent a few hours and created a simple MU plugin which allows you to do just that.

The way [Multisite Local Dev](https://github.com/kasparsd/multisite-local-dev) works is it filters all `get_option` and `get_site_option` calls for `siteurl` and `home` values to correct the site URLs. In addition, we define both `$current_site` and `$current_blog` globals already in `wp-config.php` to stop WordPress from querying database for these variables in `<a href="http://core.trac.wordpress.org/browser/tags/3.4/wp-includes/ms-settings.php">wp-includes/ms-settings.php</a>`, which is the key to this solution.

Currently this works only with sites in sub-folders, but it should be relatively easy to modify it for either subdomains or separate domains.