me['settings'] ); // Make sure we will save only settings that are present in the default theme. $settings = array_intersect_key( $settings, $default_theme['settings'] ); // Sanitize settings. $sanitized_themes[ $slug ]['settings'] = array_map( 'sanitize_text_field', $settings ); } return $sanitized_themes; } /** * Update custom themes data. * * @since 1.8.8 * * @param array $custom_themes Custom themes data. * * @return bool */ public function update_custom_themes_file( array $custom_themes ): bool { // Sanitize custom themes data to be saved. $sanitized_themes = $this->sanitize_custom_themes_data( $custom_themes ); // Determine custom themes file path. $themes_file = $this->get_custom_themes_file_path(); $json_data = ! empty( $sanitized_themes ) ? wp_json_encode( $sanitized_themes ) : '{}'; // Save custom themes data and return the result. return File::put_contents( $themes_file, $json_data ); } }