2022-10-25 17:40:31 +02:00
# Configuration
Class configuration is done by overriding the `set_defaults()` method. This method is called by the constructor, so you can safely use `$this->` in it.
```php
protected function set_defaults() {
2023-05-03 12:35:55 +02:00
$this->name = 'My Plugin';
$this->slug = 'my-plugin';
$this->version = '1.0.0';
$this->db_version = '1.0.0';
$this->has_db_tables = true;
2022-10-25 17:40:31 +02:00
}
```
## name
The plugin name.
This is used mainly for Admin notices
?> This can be safely changed at any time.
## slug
The plugin slug.
This is used for the plugin's option names, and hooks in the installer class
!> Changing the slug after the plugin has been installed will cause the plugin to be reinstalled.
## version
The plugin version.
This is used in order to determine if the plugin needs to be updated.
?> You can define this either by using an external constant, or by hardcoding it in the installer class.
## db_version
The database schema version.
Database schema version is used in order to determine if the database schema needs to be updated.
Incrementing this value will run the update callbacks
2023-05-03 12:35:55 +02:00
## has_db_tables
2022-10-25 17:40:31 +02:00
Whether the plugin has database tables.
If this is set to `true` , the installer will create and update the database tables.
?> If you set this to `true` , you need to implement the `get_schema()` method - since by default it returns an empty string.