Title: Dynamic select &#8211; get option values from shortcode
Last modified: August 22, 2023

---

# Dynamic select – get option values from shortcode

 *  Resolved [MNetto](https://wordpress.org/support/users/netto/)
 * (@netto)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/)
 * I’d like to use values from a shortcode in a dynamic select drop-down, but the
   values won’t populate as single options and it looks like this 🙁:
 *     ```wp-block-code
       -- Please select
       "China" "Peru" "Nepal"
       ```
   
 * The tag:
 *     ```wp-block-code
       [dynamic_select my-select "My-Shortcode"]
       ```
   
 * The shortcode
 *     ```wp-block-code
       function my_shortcode() {
       	$html = '"China" "Peru" "Nepal"';
       	return $html;	
       }
       add_shortcode( 'My-Shortcode', 'my_shortcode' );
       ```
   
 * I tried some variations with double and single quotes, but no success.
   Can anyone
   help me out?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Tessa (they/them), AuRise Creative](https://wordpress.org/support/users/tessawatkinsllc/)
 * (@tessawatkinsllc)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/#post-16992356)
 * I’d love to help! To use shortcodes with the dynamic select, the return value
   must be the full HTML for options or option groups. So your shortcode would look
   like this:
 *     ```wp-block-code
       function my_shortcode() {
       	$html = '<option>China</option><option>Peru</option><option>Nepal</option>';
       	return $html;	
       }
       add_shortcode( 'My-Shortcode', 'my_shortcode' );
       ```
   
 * [Here is the DTX documentation for the Dynamic Select](https://aurisecreative.com/docs/contact-form-7-dynamic-text-extension/form-tags/dynamic-select/)
   that discusses the use of the form tag while [this W3 Schools page can explain more on option and optgroup HTML](https://www.w3schools.com/tags/tag_option.asp).
 * Let me know if that works out for you!
 *  Thread Starter [MNetto](https://wordpress.org/support/users/netto/)
 * (@netto)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/#post-16992384)
 * Thank you for your quick response. I changed the shortcode accordingly but all
   values still end up in a single option:
 *     ```wp-block-code
       <option value="ChinaPeruNepal">ChinaPeruNepal</option>
       ```
   
 *  Plugin Author [Tessa (they/them), AuRise Creative](https://wordpress.org/support/users/tessawatkinsllc/)
 * (@tessawatkinsllc)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/#post-16992821)
 * I’ve been able to reproduce your error and will release a fix shortly. Thank 
   you for reporting it!
 *  Plugin Author [Tessa (they/them), AuRise Creative](https://wordpress.org/support/users/tessawatkinsllc/)
 * (@tessawatkinsllc)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/#post-16992955)
 * Should be resolved in version 4.0.2 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Dynamic select – get option values from shortcode’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7-dynamic-text-extension/assets/icon-256x256.
   png?rev=3019574)
 * [Contact Form 7 - Dynamic Text Extension](https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-dynamic-text-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-dynamic-text-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-dynamic-text-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-dynamic-text-extension/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Tessa (they/them), AuRise Creative](https://wordpress.org/support/users/tessawatkinsllc/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/dynamic-select-get-option-values-from-shortcode/#post-16992955)
 * Status: resolved