Skip to Content


Emails the previous settings to admins prior to initializing, so they can be recovered if needed.

PHP April 27, 2017


This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

This function will not email admins more than once in a 15 minute period, so multiple initializations will not cause emails within that time.

Source File

Located in /libs/Admin/Automation.php on line 307.

No Hooks

This function does not have any filters or actions available. Request one?
        public function initialization_email_prev_settings(){
            if ( !$this->is_initialized_before() ){

            $current_user = wp_get_current_user();

            $subject = 'Wordpress theme settings reset for ' . get_bloginfo('name');
            $message = '<p>Wordpress settings have been re-initialized for <strong>' . get_bloginfo('name') . '</strong> by <strong>' . $current_user->display_name . ' <' . $current_user->user_email . '></strong> on <strong>' . date('F j, Y') . '</strong> at <strong> ' . date('g:ia') . '</strong>.</p>';

            global $wpdb;
            $query_result = $wpdb->query('SELECT * FROM ' . $wpdb->options, ARRAY_A); //DB Query - Query all WP Options and return as an associative array
            $options_backup_file = get_template_directory() . '/inc/data/options_backup_' . date('Y-m-d\TH:i:s') . '.csv';
            $fp = fopen($options_backup_file, 'w');
            foreach ( $query_result as $row ){ //Loop through the array and write each row to the CSV file
                fputcsv($fp, $row);

            $attachments = array($options_backup_file);

            send_email_to_admins($subject, $message, $attachments);


This function can not be short-circuited with an override filter. Request one?