Update: 3/13/13 – The latest release of Jetpack has made it much easier to setup in a local environment

Jetpack LocalhostTo enable local development on the latest version of Jetpack:

  1. Install or upgrade to Jetpack’s latest version if you have not done so already
  2. Deactivate the plugin if you already have it installed and activated
  3. Add define ('JETPACK_DEV_DEBUG', true); to your wp-config.php file
  4. Refresh the admin panel and you should now be good to go for local development. Simply activate the modules you want to implement

This is much easier than the instructions I have outlined below. Thanks be to the Jetpack DEVs for addressing this much needed issue.

—————————————

Only proceed if using an older version of Jetpack

Jetpack is a quickly becoming one of my favorite WordPress plugins. It includes a ton of excellent features including built-in analytics (that don’t suck), social media integration, backup options, forms and subscriptions (plus much more). My one big complaint is that it’s not so simple to use when developing on localhost.

If you have tried already to enable Jetpack on your localhost you most likely saw the following message: “Your website needs to be publicly accessible to use Jetpack: site_inaccessible” followed by “Error Details: The Jetpack server was unable to communicate with your site” yadda yadda…

Jetpack Site Inaccessible

Here I’ll show you how to ‘trick’ Jetpack into thinking it’s connected to WordPress.com so you can go about development locally as normal.

Before We Start: Online and Offline Environments

To begin you will need an online WordPress environment to install Jetpack on and have access to the database either through PHPMyAdmin or another interface. For this article, we will use PHPMyAdmin to export the necessary data.

You should already have a local WordPress site setup since you are searching for this specific article BUT if don’t be sure to set that up prior to proceeding. Are you all set? Great, let’s get started with the process. It’s really not that bad…

The Solution: Jetpack for Localhost

The first step is to Install and Activate Jetpack in both your online and local WordPress environments. Once you activate Jetpack you should see the following screen:

WordPress Jetpack Activation Screen

In your online environment click the “Connect to WordPress.com” button and agree to connect your website to WordPress.com:

Jetpack Authorization

If all went well with the process you are now connected to WordPress.com in your online environment:

Jetpack Connected

How to Connect Jetpack on Localhost

Now that we have our online environment’s Jetpack connected and functional we’re going to use some of that data for our local environment. Open up PHPMyAdmin and select the database that your online environment is connected to. Click on the “SQL” tab and run the following query:

Here’s what it should look like:

Jetpack database query

You should have 1 result displaying some data in serialized format:

Jetpack SQL Query Results

Now, login to your localhost PHPMyAdmin and run this same SQL query on the database connected to your local WordPress install. You should also see one result with similar data as displayed in the image above.

Here’s the ‘trick’ to the whole process: We are going to copy-and-paste the data within the ‘option_value’ column from your online environment to your local environment. To do that we will click “Edit” in your online SQL search results and copy the data within the value field:

Jetpack Copy Data

Next change tabs/windows to the SQL results of your local database query and click “Edit” as we did before and paste the data:

Jetpack Paste Data

Don’t forget to save by clicking “Go”.

Test Your Localhost Jetpack Connection

If everything went through properly you will now be able to go to WP-Admin -> Jetpack and see the “Connected to WordPress.com” message and activate various features as expected:

Jetpack Local Connection Successful

I hope this helps some other developers and WordPressers out there! If you are having any issues please use the comments below!

Devin Walker is a San Diego-based WordPress Developer and enthusiast. He is the author of several popular and highly-rated WordPress themes and plugins. In his free time he enjoys playing Golf and traveling.

Follow Devin:

7 Responses to “How To Use WordPress Jetpack for Local Development”

  1. Johnny

    Will there be a problem be you put the site live?

    Reply
  2. Johnny

    Will there be a problem be you put the site live?

    Reply
  3. mikbe

    Thank you so much! It’s been driving me crazy that I had to keep manually editing Jetpack to trick it into thinking it was online.

    Reply
  4. mikbe

    Thank you so much! It’s been driving me crazy that I had to keep manually editing Jetpack to trick it into thinking it was online.

    Reply
  5. Luc Poupard

    So easy and so efficient too ! Thanks a lot for this little trick 😀

    Reply
  6. Mike Swimm

    Awesome! Thank you for the post, this has been a pain development pain.

    Reply
  7. George

    Please help this newbie. My wp-config.php and wp-config-sample.php have not had any personal data entered. Is that necessary before the define (‘JETPACK_DEV_DEBUG’, true); is
    is added? Either way, exactly where does this go in the file?

    Thanks for your help,
    George

    Reply

Leave a Reply