Title: Error in shortcode syntax for contact-form-7
Last modified: August 30, 2016

---

# Error in shortcode syntax for contact-form-7

 *  [mstdmstd](https://wordpress.org/support/users/mstdmstd/)
 * (@mstdmstd)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/error-in-shortcode-syntax-for-contact-form-7/)
 * Hi,
    I want to make plugin with new shortcode for contact-form-7(Version 4.3)
   like :
 *     ```
       if (!class_exists('nsnSourceSelection')) {    // nsn-source-selection
           class nsnSourceSelection {
               public function __construct()
               {
                   DEFINE('nsnSourceSelection', true); // Pluging is inited
                   add_action('plugins_loaded', array($this, 'init'), 120);
               } // function nsnSourceSelection() // constructor of plugin class
   
               public function init() {
                   if(function_exists('wpcf7_add_shortcode')){
                       wpcf7_add_shortcode('nsnsourceselection', array($this, 'nsnsourceselection_shortcode_handler'), true);
                       wpcf7_add_shortcode('nsnsourceselection*', array($this, 'nsnsourceselection_shortcode_handler'), true);
   
                   }
                   add_filter('wpcf7_validate_nsnsourceselection', array($this, 'nsnsourceselection_validation'), 10, 2);
                   add_filter('wpcf7_validate_nsnsourceselection*', array($this, 'nsnsourceselection_validation'), 10, 2);
                   add_filter( 'wpcf7_validate_favourite-song*', 'custom_favourite_song_validation_filter', 20, 2 );
                   if ( is_admin() ) { // That is admin page
                       add_action('admin_init', array($this, 'add_tag_source_selection_generator'), 25);
       ```
   
 *  …
 * In contact Editor form I have button registered and clicking it form is opened
   in which I genarate my selection input with dynamic data. It has next synttax:
 *     ```
       [nsnsourceselection * favourite-song-category id:id-favourite-song-category  type_of_selection:dropdown source_function:nsn_get_artists_songs_categories sort:post_title  option_value_field:ID option_label_field:name select_label:"Favourite Song's Category"  class:" favouritesongcategory"  "XZcvZ"]
       ```
   
 * Problems are :
    1) As function nsnsourceselection_validation defined as validation
   handler in this function I get $tag parameter with empty elaments name, options.
   I think the reason on these parameters empty is invalid format of my syntax above.
   Is it so? Could yoy clarify what is wrong in syntax?
 * also I read syntax doc from here [http://contactform7.com/tag-syntax/#mail_tag](http://contactform7.com/tag-syntax/#mail_tag),
   could you please give reference to syntax rules here?
    As example I use dynamic-
   select-extension: [https://github.com/Hube2/contact-form-7-dynamic-select-extension](https://github.com/Hube2/contact-form-7-dynamic-select-extension)
 * 2) Changing some parameters in my tag syntax very often I do not see my selection
   input in resulting page at all.
    Ex: If in syntax above to remove 2 options at
   end, like:
 *     ```
       [nsnsourceselection * favourite-song-category id:id-favourite-song-category  type_of_selection:dropdown source_function:nsn_get_artists_songs_categories sort:post_title  option_value_field:ID option_label_field:name  "XZcvZ"]
       ```
   
 * I saw only text of this tag in page , but not control input…
 * What wrong in my syntax?
 *  Thanks!
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

The topic ‘Error in shortcode syntax for contact-form-7’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 0 replies
 * 1 participant
 * Last reply from: [mstdmstd](https://wordpress.org/support/users/mstdmstd/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/error-in-shortcode-syntax-for-contact-form-7/)
 * Status: not resolved