Title: Second Shortcode Attribute needed
Last modified: September 7, 2018

---

# Second Shortcode Attribute needed

 *  Resolved [manuka](https://wordpress.org/support/users/manuka/)
 * (@manuka)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/second-shortcode-attribute-needed/)
 * Hello,
 * I use Shortcode Attributes as in:
    [https://contactform7.com/getting-default-values-from-shortcode-attributes/](https://contactform7.com/getting-default-values-from-shortcode-attributes/)-
   > which is working perfectly fine so far. But now I need a second Shortcode Attribute
   for the same form.
 * Could you please be so kind as to provide the additional code which I have to
   put in the function.php? I cannot figure out, where and how to add the second
   attribute (which might for example be named “subject”) in the function:
 * add_filter( ‘shortcode_atts_wpcf7’, ‘custom_shortcode_atts_wpcf7_filter’, 10,
   3 );
 * function custom_shortcode_atts_wpcf7_filter( $out, $pairs, $atts ) {
    $my_attr
   = ‘destination-email’;
 *  if ( isset( $atts[$my_attr] ) ) {
    $out[$my_attr] = $atts[$my_attr]; }
 *  return $out;
    }
 * I tried a few things, but didnt work.. (I am not a php-expert :-/)
 * Thank you very much for your help
    manuka

Viewing 1 replies (of 1 total)

 *  Thread Starter [manuka](https://wordpress.org/support/users/manuka/)
 * (@manuka)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/second-shortcode-attribute-needed/#post-10667883)
 * ok, solved it now…
    🙂
 * In case anyone interested:
 * add_filter( ‘shortcode_atts_wpcf7’, ‘custom_shortcode_atts_wpcf7_filter’, 10,
   3 );
 * function custom_shortcode_atts_wpcf7_filter( $out, $pairs, $atts ) {
    $my_attr1
   = ‘destination-email’; if ( isset( $atts[$my_attr1] ) ) { $out[$my_attr1] = $
   atts[$my_attr1]; } return $out; }
 * add_filter( ‘shortcode_atts_wpcf7’, ‘custom_shortcode_atts_wpcf7_filter2’, 10,
   3 );
 * function custom_shortcode_atts_wpcf7_filter2( $out, $pairs, $atts ) {
    $my_attr2
   = ‘subject’; if ( isset( $atts[$my_attr2] ) ) { $out[$my_attr2] = $atts[$my_attr2];}
   return $out; }

Viewing 1 replies (of 1 total)

The topic ‘Second Shortcode Attribute needed’ 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/)

 * 1 reply
 * 1 participant
 * Last reply from: [manuka](https://wordpress.org/support/users/manuka/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/second-shortcode-attribute-needed/#post-10667883)
 * Status: resolved