{"id":11093,"date":"2022-03-22T15:00:03","date_gmt":"2022-03-22T14:00:03","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?p=11093"},"modified":"2022-03-22T15:00:03","modified_gmt":"2022-03-22T14:00:03","slug":"how-to-globally-enable-html-for-cf7-mails","status":"publish","type":"post","link":"https:\/\/www.welaunch.io\/en\/2022\/03\/how-to-globally-enable-html-for-cf7-mails\/","title":{"rendered":"How to Globally Enable HTML for CF7 Mails"},"content":{"rendered":"<p>If you do not want to enable &#8220;Use HTML&#8221; for every contact form 7 forms, then you can use the following code snippet:<\/p>\n<pre>function we_cf7_always_use_html($cf){\r\n\r\n    $wpcf7 = WPCF7_ContactForm::get_current();\r\n    $submission = WPCF7_Submission::get_instance();\r\n    if (!$submission){\r\n        return;\r\n    }\r\n\r\n    $mail2 = $wpcf7-&gt;prop('mail_2');\r\n    if(!empty($mail2)) {\r\n    \t$mail2['use_html'] = true;\r\n    \t$wpcf7-&gt;set_properties( array(\"mail_2\" =&gt; $mail2)) ;\r\n    }\r\n}\r\nadd_action( 'wpcf7_before_send_mail', 'we_cf7_always_use_html' );\r\n<\/pre>\n<p>This will globally enable the use_html filter for all mails.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you do not want to enable &#8220;Use HTML&#8221; for every contact form 7 forms, then you can use the following code snippet: function we_cf7_always_use_html($cf){ $wpcf7 = WPCF7_ContactForm::get_current(); $submission = WPCF7_Submission::get_instance(); if (!$submission){ return; } $mail2 = $wpcf7-&gt;prop(&#8216;mail_2&#8217;); if(!empty($mail2)) { $mail2[&#8216;use_html&#8217;] = true; $wpcf7-&gt;set_properties( array(&#8220;mail_2&#8221; =&gt; $mail2)) ; } } add_action( &#8216;wpcf7_before_send_mail&#8217;, &#8216;we_cf7_always_use_html&#8217; ); This&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1,8],"tags":[],"class_list":["post-11093","post","type-post","status-publish","format-standard","hentry","category-general","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts\/11093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=11093"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts\/11093\/revisions"}],"predecessor-version":[{"id":11094,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/posts\/11093\/revisions\/11094"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=11093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/categories?post=11093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/tags?post=11093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}