Код: Выделить всё
add_action( 'wpcf7_before_send_mail', 'wpcf7_do_something_else_with_the_data', 90, 1 );
function wpcf7_do_something_else_with_the_data( $WPCF7_ContactForm ){
// Submission object, that generated when the user click the submit button.
$submission = WPCF7_Submission :: get_instance();
if ( $submission ){
$posted_data = $submission->get_posted_data();
if ( empty( $posted_data ) ){ return; }
// Got name data
$name_data = $posted_data['your-name'];
if( is_page( 41235 ) ) {
// Do my code with this name
$changed_name = 'something with is page condition';
} else {
// Do my code with this name
$changed_name = 'something is in else condition';
}
// Got e-mail text
$mail = $WPCF7_ContactForm->prop( 'mail' );
// Replace "[your-name]" field inside e-mail text
$new_mail = str_replace( '[your-name]', $changed_name, $mail );
// Set
$WPCF7_ContactForm->set_properties( array( 'mail' => $new_mail ) );
}
return $WPCF7_ContactForm;
}
но решения нет.
Подробнее здесь: https://stackoverflow.com/questions/761 ... ion-inside
Мобильная версия