Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @jonny-s

    In your page:

    [contact-form-7 id="123" title="Contact Form" destination-email="[email protected]" destination-email2="[email protected]"]

    In CF7:

    [email* destination-email default:shortcode_attr]
    [email* destination-email2 default:shortcode_attr]

    In functions.php:

    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', 'destination-email2'];
    
    	foreach ( $my_attr as $key => $value ) {
    		if ( isset( $atts[$value] ) ) {
    			$out[$value] = $atts[$value];
    		}
    	}
    
    	return $out;
    }
    Thread Starter jonny-s

    (@jonny-s)

    That works!

    Thank you very much!

    Marcos Nakamine

    (@marcosnakamine)

    You’re welcome =)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to register two attributes for default:shortcode_attr’ is closed to new replies.