How to use WordPress Jetpack on localhost

After you installed the Jetpack plugin on localhost, you should ended up with something like:


When you click on “Connect to”, you will get error messages.  Jetpack requires a publicly accessible website in order to work.  The way we are going to make this work is making Jetpack believes that it has been connected to WordPress.

  1. Go to the plugin directory.  This depends on your installation, in my case:
    cd /MAMP/myDemo2/wp-content/plugins/jetpack
  2. Search file for the class definition of jetpack_data
    As I am using Mac (or Unix), I use:

    grep -R jetpack_data *
    class.jetpack-data.php:class Jetpack_Data {
  3. As in last step, found the file as class.jetpack-data.php, edit the file and make it always return true, in my example, I add a line and the file looks like:
    public static function get_access_token( $user_id = false ) {
    return true;

Then your Jetpack should now works.

This fix works for WP 3.6 + Jetpack 2.5

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>