I'm using contact form 7 and here is the actual contact form 7 code to display the select drop down

<div class="select-wpr">[select* program id:program first_as_label required "Choose your program of interest"]</div></div>
<div class="full-width">
<div class="select-wpr">[select* campus id:campus first_as_label "Choose campus"]</div>

Where can I go and modify the actual select drop down options? I want to add <optgroup> to the select options but can't find where to go and modify that. Where is that located in wordpress?


This is not possible with Contact Form 7 plugin. Instead you can make use of the dynamic_dropdown tag offered by the CF7 plugin extension, CF7 Smart Grid-layout. This allows you to create a dynamic dropdown, which has an option to filter the drodown's options, and therefore create a custom set of options,

add_filter('cf7sg_dynamic_dropdown_custom_options', 'custom_options');
function custom_options($options){
  return "

the plugin enables filter helpers once you insert a tag field in your form. these helpers have more information to help you with their functionality.

Not the answer you're looking for? Browse other questions tagged or ask your own question.