Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contact Form 7 auto added p tags

I have next code inside contact form 7 editor

<div class="row">     <div class="col-sm-8 col-sm-offset-2">         <div class="row">             <div class="col-sm-4">                 [text* name class:border-field placeholder "Name"]             </div><!-- End of col -->             <div class="col-sm-4">                 [email* email class:border-field placeholder "Email"]             </div><!-- End of col -->             <div class="col-sm-4">                 [text subject class:border-field placeholder "Subject"]             </div><!-- End of col -->         </div><!-- ENd of row -->     </div><!-- End of col --> </div><!-- ENd of row -->  <div class="row">     <div class="col-sm-8 col-sm-offset-2">         [textarea message class:border-field placeholder "Message"]     </div> </div><!-- End of row -->  <div class="row text-center">     <div clas s="col-sm-12">             [submit class:btn class:btn-black-fill class:btn-small "Submit"]       </div><!-- End of col --> </div><!-- End of row --> 

The problem is that it adds random p tags almost after each element and also that first text field is for some reason little bit above other two fields when they should all be inline. And i think this is not css problem because previously i had this coded in plane HTML and all fields were inline so i think it must be something with contact form 7.

like image 990
Nenad Vracar Avatar asked Sep 12 '15 14:09

Nenad Vracar


People also ask

Which is the default HTML tag of Contact form 7?

The default Contact Form 7 form uses paragraph elements (<p>Paragraph Content</p>) as the basis for the form.

Can I use PHP in Contact form 7?

The Contact Form 7 plugin is great, and works with PHP 8.0 without noticeable issues.


2 Answers

According to the Contact Form 7 Docs, you can disable "wpautop" for the plugin by placing the following constant in wp-config.php:

define( 'WPCF7_AUTOP', false ); 
like image 166
rnevius Avatar answered Sep 20 '22 16:09

rnevius


If editing wp-config.php is not the solution for you, there's a handy filter. Put it in your functions.php:

// Remove <p> and <br/> from Contact Form 7 add_filter('wpcf7_autop_or_not', '__return_false'); 
like image 24
skip405 Avatar answered Sep 20 '22 16:09

skip405