The word press API is not displayed in, so I still like this one. Review this sample to learn how to use the sample implementation\/\/ Create a new project
$big_item= new item ();
$big_item-> size = \
$big_item-> year = \
$big_item->title= \
$big_item-> save();
\/\/Gets the size of the saved item
$true_item= new item (42);
Echo$true_item-> size; In this code, the magic\u get() and \u set() methods are used to create new entries in the database, query and return data using various properties of the class. Data is stored in posts that are not visible in the outside world. The
If you use this system to create a plug-in, save the data as a post in a later version, and then switch to saving the data in a custom table later, the code will not be interrupted. Yes, you must recreate the interior of the class and create the migration system. However, all code that uses this database abstraction still works the same way. In the first article in this series, I talked about the reasons for creating database abstractions. A good database abstraction can create an API that interfaces with WordPress and make the database invisible. If these APIs are made \
A good database abstraction is essentially a black box. Data flows in and out, but I don’t know why or how. We don’t need to know why or how. It just works, and we can build on it the way we want. Please show the value of creating database abstractions on top of the WordPress API in this and the last two articles. In operation, the faster the database abstraction is adopted, the more stable the project is, and the easier it is to change the way data is stored in the future. It is easy to replace options or post \/ post metadata storage with custom table storage. So, read Pippin Williamson’s excellent series to create a custom table API that starts here.