I am working on an API for wordpress and I am looking for a way to uniquely identify a wordpress installation that is requesting the API. Does anyone know of a install id or unique wordpress blog id? Is that even a thing?
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
I have written 2 APIs and have worked with several, I stumbled upon this question long time back...
I like to keep the stuff simple... so I use
site_url()
as identity of the blog, since I'm sure no other installation would run on the same site url so whenever there is an issue to debug, I know site ID is the url.Saved one extra field in my DB ( If I had ID different, I'd need another field for site url ).
You can also go for complex solutions like using md5 of site_url along with some random generated strings to name a few.
Update
This will generate an ID on activation and save it in the database.
Code in
my_plugin_activated()
is executed only once on activation of plugin ( you can do the same for theme