Last active
December 11, 2015 20:09
-
-
Save yannisdran/4652960 to your computer and use it in GitHub Desktop.
A hack for being able to run Jetpack in WP locally.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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