Remove p tags from Contact Form 7

It is better to have full control of styling everything when we are coding a custom wordpress theme. Contact Form 7 is a widely using form generation plugin over the wordpress community. All the input elements of Contact Form 7 are coming with wrapped paragraph element. If you view source or inspect element on your browser, you’ll see

tag although we have not added it when we creating the form. If you ever wanted to remove this automatically added p ( paragraph ) tag, here is the answer for that.

To do this, you’ll have to have FTP access to edit the file. Here are the steps you’d have to follow.

    1. Login to wordpress installation directory via FTP client or SSH.
    2. Locate this directory /wp-content/plugins/contact-form-7
    3. Open wp-contact-form-7.php file to edit
    4. Find the following code, and set that option to false
if ( ! defined( 'WPCF7_AUTOP' ) ) {
define( 'WPCF7_AUTOP', true );

Thats it. If you view source of the form after re-fresh the browser, you would not see <p> tag around each input fields.