get_header( 'X-API-KEY' ) ?: '' ); } public static function nonceCallback( WP_REST_Request $request ): bool { $nonce = $request->get_header( 'X-WP-Nonce' ); return $nonce && wp_verify_nonce( $nonce, 'wp_rest' ); } public static function getValidated( WP_REST_Request $request ): array { $allowed = array_keys( $request->get_attributes()['args'] ); return array_intersect_key( $request->get_params(), array_flip( $allowed ) ); } }