Skip to content

Instantly share code, notes, and snippets.

@jayllellis
Last active August 3, 2021 08:34
Show Gist options
  • Save jayllellis/e12b1ca324b22fd768b6bb6fc1e82584 to your computer and use it in GitHub Desktop.
Save jayllellis/e12b1ca324b22fd768b6bb6fc1e82584 to your computer and use it in GitHub Desktop.
Custom Contact Form 7 action URL
<?php
// Place this in your functions.php file
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url(){
return 'send.php';// replace this with the new action url (excluding the 'http://')
}
?>
@abdechakour
Copy link

If you want to change the url of one form

`<?php

// Place this in your functions.php file
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url( $url ){
$wpcf7 = WPCF7_ContactForm::get_current();
$wpcf7_id = $wpcf7->id();
if ( $wpcf7_id == your_form_id ) {
$url = 'send.php';// replace this with the new action url (excluding the 'http://')
}
return $url;
}

?>`

@indiarocks08
Copy link

how to change form method from POST to GET , pls share that code too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment