Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Initializes the plugin settings fo ruse throughout the rest of the plugin.
*/
private function initialize () {
$settings = [
'username' => '',
'user-info' => [
'location' => '',
'id-number' => '',
'first-name' => '',
'last-name' => '',
],
'short-bio' => '',
];
update_option('acme-plugin-settings', $settings);
}
<?php
/**
* Intiializes the properties of the class, primarily the array of settings.
*/
public function __construct() {
if (false === get_option('acme-plugin-settings')) {
$this->initialize();
}
// More to come...
}
<?php
/**
* Intiializes the properties of the class, primarily the array of settings.
*/
public function __construct() {
if (false === get_option('acme-plugin-settings')) {
$this->initialize();
}
$this->settings = get_option('acme-plugin-settings');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment