max
CDCloudflare Developers
•Created by dhakkad on 11/17/2023 in #d1-database
I'm not sure about this but is there a
I'm a complete newb on D1 and have never used wordpress, but I feel bad I buried your question with my massive one, so I thought I'd offer:
It looks like D1 has an API you can hit directly from api.cloudflare.com. E.g., here's the docs to run a query:
https://developers.cloudflare.com/api/operations/cloudflare-d1-query-database
I think you need to provide an authorization header (top right of that page has a request sample), so I think you'd want to run this the word press server (with PHP) not on the client (with JS). That request sample has "cURL" and "guzzle" examples for PHP. GPT-4 tells me you could store your token in your
wp-config.php
wordpress config file, and that wordpress provides wp_remote_get()
and wp_remote_post()
functions that you could use to make the call. I hope this is helpful!2 replies