The Database extension is used for basic options and post meta, get and update utilities.



This is a standalone extension and does not depend on other extensions.


This extension acts as a delegate (as in “used by”) for the form and admin extensions. Moreover, it may be a delegate for many others.

How to install

Make sure you have read the extension installation guide first.

To install this extension, place the following inside the “require” block of the composer.json file.

Now run composer install  in your terminal. Thats it!

Usage - Options

We will be diving straight ahead with $this->Boots  to see how we can consume this extension. $this->Boots  is assumed a class property and an instance of Boots. If you still can’t figure that out, Look here.

Get an option

To retrieve an option from the WordPress database, this is how we approach:

The above is an alias of the WordPress function get_option('admin_email');

Update an option

Updating an option is also quite similar:

Usage - Post Meta

Get a post meta

To retrieve the field ‘_post_meta_field_name’ post meta for the post id ’97’ from the WordPress database:


For modifying the ‘single’ (true by default) field, which when set to false (WordPress default), is used for returning multiple rows of the same field. We approach as follows:

Or, this way

Any mixed combination will work for the above.

Update a post meta

To update a post meta field (say  ‘_post_meta_field_name’) for a post (say id ‘123’) from the WordPress database:

To update only for a previous value match (useful to update only a specific row when there are multiples of the same field),


A die hard programmer!