A hack for being able to run Jetpack in WP locally.
# Go to plugins/jetpack/jetpack.php into the folder of your WP local website. | |
# Find the line (276) below: | |
/** | |
* Is Jetpack active? | |
*/ | |
public static function is_active() { | |
return (bool) Jetpack_Data::get_access_token( JETPACK_MASTER_USER ); | |
} | |
# Replace it with: | |
/** | |
* Is Jetpack active? | |
*/ | |
public static function is_active() { | |
return true; | |
} | |
# Find the line (2263) below: | |
function admin_page() { | |
global $current_user; | |
$role = $this->translate_current_user_to_role(); | |
$is_connected = Jetpack::is_active(); | |
$user_token = Jetpack_Data::get_access_token($current_user->ID); | |
$is_user_connected = $user_token && !is_wp_error($user_token); | |
$is_master_user = $current_user->ID == Jetpack::get_option( 'master_user' ); | |
$module = false; | |
?> | |
# Replace &is_user_connected to: | |
$is_user_connected = true; | |
# End | |
# Before migrating WP site to live, put back the original one. | |
# Source: http://wordpress.stackexchange.com/questions/42352/jetpack-running-locally |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment