How to limit an access key to a specific site

Using the Code Snippet plugin you can filter the access key verification check to make sure access is only given to a specific site.

Add a PHP snippet with the following code, just changing your ACCESS_KEY and WEBSITE.COM with the key you want to limit and the site you want to limit it to.

 * Checks for specific key and makes sure that key only works on a specific site.
 * @param Boolean $access true or false based on access.
 * @param String $key the access key.
 * @param WP_REST_Request $request full details about the request.
 * @return Boolean based on if access should be granted.
function custom_kadence_cloud_access_filter( $access, $key, $request ) {
    if ('ACCESS_KEY' === $key ) {
        $site = preg_replace("(^https?://)", "", $request->get_param( 'site' ) );
        if ( $site && 'WEBSITE.COM' === $site ) {
            return true;
        } else {
            return false;
    return $access;
add_filter( 'kadence_cloud_rest_request_access', 'custom_kadence_cloud_access_filter', 10, 3 );