1
遷移到新AWS實例並從apache移動到nginx後,我遇到了以前沒有的wp_kses問題。wp_kses缺少兩個參數問題
表單提交和所有的處理順利,但不是重定向到成功頁面我得到這樣一個錯誤信息:
警告:缺少論據2 wp_kses(),稱爲路徑/到/線20上一個/ file.php和在根定義/文件夾/的public_html /可溼性粉劑包含在線路521
/kses.php這是我的用於處理形式代碼
//Template Name: Jobs: Add mini ad form process
if (!wp_verify_nonce($_POST['ad_mini_add_nonce'], 'submit_add_mini_ad_form')) :
echo 'Sorry your nonce didn\'t verify';
exit;
endif;
// Checking for secret filed
if (isset($_POST["secret_field"]) && !empty($_POST["secret_field"])) :
echo 'Sorry, could not send.';
exit;
endif;
// process form data
$position_name = wp_kses($_POST['position_name']);
$company_name = wp_kses($_POST['company_name']);
$location = wp_kses($_POST['location']);
$link_for_apply = wp_kses($_POST['link_for_apply']);
$website = wp_kses($_POST['website']);
$name = wp_kses($_POST['name']);
$email = wp_kses($_POST['email']);
$phone = wp_kses($_POST['phone']);
// Create new add - privately published
$new_ad = array(
'post_title' => $position_name,
'post_type' => 'post',
'post_status' => 'private',
'post_author' => 1001189, //Tanja Mladenovic
);
$new_ad_id = wp_insert_post($new_ad);
$new_ad_url = get_post_permalink($new_ad_id);
$next_month = date('Ymd', strtotime('+30 days', time()));
// Fill custom fileds
add_post_meta($new_ad_id, 'company_location', $location);
add_post_meta($new_ad_id, 'ad_type', 'mini');
add_post_meta($new_ad_id, 'company_name', $company_name);
add_post_meta($new_ad_id, 'webiste', $webiste);
add_post_meta($new_ad_id, 'expire', $next_month);
add_post_meta($new_ad_id, 'contact_person_name', $name);
add_post_meta($new_ad_id, 'contact_person_phone', $phone);
add_post_meta($new_ad_id, 'contact_person_email', $email);
add_post_meta($new_ad_id, 'type_of_apply', 'link');
add_post_meta($new_ad_id, 'link_for_apply', $link);
我知道wp_kses可以還有兩個參數所有的東西都可以在沒有麻煩的情況下工作。官方單證說wp_kses第二個參數「allowed_html」現在沒有的默認值(而這正是我想要的),而第三個參數「allowed_protocols」是可選