Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created November 22, 2016 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tommcfarlin/76522dbf7589f88048abbaac42493dbf to your computer and use it in GitHub Desktop.
Save tommcfarlin/76522dbf7589f88048abbaac42493dbf to your computer and use it in GitHub Desktop.
[WordPress] Initializing Default WordPress Options
<?php
public function set_options() {
$this->options = array_merge(
$this->get_default_options(),
get_option( 'acme_options_example', array() )
);
}
public function get_default_options() {
$defaults = array(
'social' => array(
'twitter' => '',
'google' => '',
'instagram' => '',
),
'web' => array(
'site' => '',
'email' => '',
)
);
return $defaults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment