我在我的Wordpress网站上添加了一个ninja_form,我需要在提交这个ninja_form时调用php函数,我该怎么做?
感谢您的回复
答案 0 :(得分:3)
<?php
function ninja_forms_register_example(){
add_action( 'ninja_forms_process', 'ninja_forms_example' );
}
add_action( 'init', 'ninja_forms_register_example' );
function ninja_forms_example(){
global $ninja_forms_processing;
//Get all the user submitted values
$all_fields = $ninja_forms_processing->get_all_fields();
if( is_array( $all_fields ) ){ //Make sure $all_fields is an array.
//Loop through each of our submitted values.
foreach( $all_fields as $field_id => $user_value ){
//Do something with those values
}
}
}`