I installed WordPress and the contact form 7 plugin in it.
To create a multi-page contact form, I also installed Contact Form 7 Multi-Step Forms . So far, everything is working fine. Even mail is sent.
The problem that I am facing is that I want to run some PHP code before sending sent emails.
I inserted this code to try the possibility of its launch.
function testfunc( $cf7 ) { mysql_connect("localhost", "user_name", "password") or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error()); mysql_query("CREATE TABLE `aaaaaaaaaaa` ( test VARCHAR(30))"); } add_action( 'wpcf7_before_send_mail', 'testfunc', 1);
The function even works fine when I run it outside the plugin in an additional php file.
Now I canβt understand why the function does not work when pasted into the plugin?
source share