You are not alone, look at the latest entries in the forum. Honestly, I can’t understand how you can be bombarded with one and the same message for over 2 days but simply not make a statement. Why are other questions being answered? Does that mean a solution is not being worked on?
I appreciate the work of @takayukister, but I simply don’t understand how the community can be left in ignorance about such obvious problems. I would even settle for “that’s just the way it is from now on”, but I want an answer. Do I have to carry out over 200 updates or not?
I haven’t found a statement about the error message in v 5.7 yet either, same points there.
I would like to add that define('WPCF7_AUTOP', false); does not fix anything
UPDATE: It does fix if you edit from wp-config.php, otherwise it’s possible to use
add_filter('wpcf7_autop_or_not', '__return_false'); in theme’s functions.php
-
This reply was modified 3 years, 5 months ago by
frafor. Reason: workaround
@frafor Neither of your solutions seems to work on my site.
I’m running on Genesis and I have activated the checkbox for using HTML-content in the the form.
I don’t know about Genesis but it should, I’m on GeneratePress anyway. Otherwise you can install Rollback and go to previous version.
Solution for the form:
wp_config.php: define('WPCF7_AUTOP',false);
functions.php: add_filter('wpcf7_autop_or_not','__return_false');
Provisional solution for the HTML mail:
in line 93 the /wp-content/plugins/contact-form-7/includes/mail.php
$html = $header.wpcf7_autop($body).$footer;
CHANGE TO
$html = $header.$body.$footer;
-
This reply was modified 3 years, 5 months ago by
icodina.
Seems to be fixed in 5.7.1.
Thank you sir.
Correction: The wp-config.php fix seems to work for me anyway. Sorry for the confusion.
But it works only for the rendering of the form in the frontend which was never a problem in my case.
My issue is with the rendering of a html formatted email.
Which I have explained in detail here:
https://ww.wp.xz.cn/support/topic/ver-5-7-1-hasnt-fixed-styling-issue/#post-16300946
I have the same problem. I know that forms can be fixed with one of the following solutions (both worked for me):
define('WPCF7_AUTOP', false);
add_filter('wpcf7_autop_or_not', '__return_false');
But I couldn’t find a proper solution to avoid unwanted p and br tags in HTML emails. The only way seems to be to edit the file “contact-form-7/includes/mail.php” – as described above by @icodina.
Is there any better way to prevent Contact Form 7 from applying the wpcf7_autop() function to emails?
AW
(@geykgn)
Hi,
There was a solution in this topic (February 27, 2023), but it was removed – I wonder what was the basis for such moderation?
Perhaps the solution in this post is what you are looking for.
I absolutely agree with everything in the first post you mentioned, @geykgn. It would be very desirable to have an option to disable the wpcf7_autop() function for mails.
The solution in the second post didn’t work for me.