title: How can I set and get the values of a multiple select with the Wordpress settings API for a theme options page?
body: <p>I want to use a 'multiple select field' for a field in the theme option page using settings API.</p>
  
  <p>I tried with the below code but unable to save all the selected values, it only saves last one selected.</p>
  
  <pre><code>add_action('admin_menu', 'create_theme_options_page');
  
  function create_theme_options_page() {  
  add_options_page('Theme Options', 'Theme Options', 'administrator', 'inc/site-options.php', 'build_options_page');
  }
  
  add_action('admin_init', 'register_and_build_fields');
  
  function register_and_build_fields() {   
  register_setting('plugin_options', 'plugin_options', 'validate_setting');
  add_settings_field('clusters', 'Choose Clusters to show:', 'cluster_setting', __FILE__, 'site_section');
  } 
  
  function cluster_setting() {  
  $options = get_option('plugin_options');
  
  echo "&lt;select name='plugin_options[clusters]' multiple='multiple'&gt;
  &lt;option value='location'&gt;Location&lt;/option&gt;
  &lt;option value='role'&gt;Role&lt;/option&gt;
  &lt;option value='functional'&gt;Functional Area&lt;/option&gt;
  &lt;option value='industry'&gt;Industry&lt;/option&gt;
  &lt;/select&gt;"
  }
  </code></pre>
  
  <p>How can I select multiple values from the select element and save them.</p>
  
  <p>Any help will be appreciated.</p>