I am developing plugin right now, and I have one questions about best practices
and conventions.
What I need ?
My plugin is going to store some predefined object, list of objects (or just arrays/key-value pairs) and it will be possible to add new object and fill its fields.
For example my object will have following content
{
"id": 123,
"url": "http://google.com/",
"enabled" : true,
"name": "hello_world",
"api_key" : "api_key"
}
Simple JSON
object.
And on Plugin Admin configuration page
it will be possible to add, edit or remove such objects.
What is my question ?
What is the best way of storing such data. I have installed a lot of different plugins in order to see how does custom data from settings is stored. There some options I have seen
Using
Settings API
provided byWordpress
. EvenUI
is handled by wordpress, you can just call the function and it will create proper input field and than save all settings into options table. All checks and security is handled by wordpress as well. But is it possible to create dynamic admin page where you can add new items ?Using old
Options API
is also stored in the options table, but gives more freedom to developer to handle all validation.Creating new database table and save data in it.
I don't think I am going to use third method.
Please suggest better way to do this or maybe you know the plugin already implemented such functionality in a right way. I would grateful for any help.