Back to Browse

How to Get Default Values from Shortcode Attributes in contact form 7 | Wordpress

2.4K views
May 15, 2019
7:50

Sometimes you may feel that it would be useful if you could use values from [contact-form-7 ...] shortcode attributes. In such cases, you can use the default:shortcode_attr form-tag option, which retrieves the field default value from shortcode attributes. default:shortcode_attr How get custom value in contact form 7 shortcode in wordpress add_filter( 'shortcode_atts_wpcf7', 'custom_shortcode_atts_wpcf7_filter', 10, 3 ); function custom_shortcode_atts_wpcf7_filter( $out, $pairs, $atts ) { $my_attr = 'role_title'; if ( isset( $atts[$my_attr] ) ) { $out[$my_attr] = $atts[$my_attr]; } return $out; }

Download

0 formats

No download links available.

How to Get Default Values from Shortcode Attributes in contact form 7 | Wordpress | NatokHD