Skip to content

Commit

Permalink
If the user is logged in, it's a WP.com request
Browse files Browse the repository at this point in the history
  • Loading branch information
justinshreve committed Oct 24, 2024
1 parent 744c926 commit 91da91d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ public function check_permissions() {
return current_user_can( 'manage_options' );
}

// If we are logged in as a user, we can allow access to the endpoint, as it is a request from a WordPress.com blog
if ( is_user_logged_in() ) {
return true;
}

// If we are not logged in as a user, we need to check if the site is an Atomic site or a Jetpack site
// and has a valid Jetpack blog token.

if ( ! class_exists( 'WPCOM_REST_API_V2_Endpoint_Jetpack_Auth' ) ) {
require_once dirname( __DIR__ ) . '/rest-api-plugins/endpoints/jetpack-auth.php';
}
Expand Down

0 comments on commit 91da91d

Please sign in to comment.