Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created October 30, 2018 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/5a9940d1364b4d15e1de755f78bd0a79 to your computer and use it in GitHub Desktop.
Save tommcfarlin/5a9940d1364b4d15e1de755f78bd0a79 to your computer and use it in GitHub Desktop.
<?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