WordPress.org

Support

Support » Themes and Templates » Help with setting defaults in wp_options for clients theme

Help with setting defaults in wp_options for clients theme

  • I’m sure someone with tons of WP development experience can help me out. I have a client that has a custom wp theme that he uses, which has several options in the wp_options table.

    What he would like to do is install the theme on sites with some of these options already set so he doesn’t have to keep entering the same data over and over. For example ‘theme_contact_email’ would always default to ‘bob@somewhere.com’

    I’m sure there is a simple solution – I just don’t know what to search for to find the answer I need. I thought it might be adding set_option somewhere in the template set-up function? I don’t see any of the options being created there though so I’m stumped.

Viewing 1 replies (of 1 total)
  • to check if the theme is the first time activated:

    if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
      // load your default data
    }

    Load the default data when your first activate your theme.

Viewing 1 replies (of 1 total)
  • The topic ‘Help with setting defaults in wp_options for clients theme’ is closed to new replies.
Skip to toolbar