0
如何在wordpress中處理$ _POST?我正在創建一個自定義的「發送」按鈕,該按鈕顯示在我的插件的管理面板中。當按下「發送」按鈕時,郵件必須發送給用戶。但是,這怎麼做呢?我如何處理自定義「發送」$ _POST按鈕?
我曾嘗試使用init做到這一點,但沒有更迭:
add_action('manage_nieuwsbrief_posts_custom_column', 'nwsbrf_custom_nieuwsbrief_column', 10, 2);
function nwsbrf_custom_nieuwsbrief_column($column, $post_id) {
global $wpdb;
$getcategories = $wpdb->get_results($wpdb->prepare("SELECT * FROM wp_nwsbrf_couple INNER JOIN wp_nwsbrf_categories WHERE wp_nwsbrf_couple.category_id = wp_nwsbrf_categories.category_id AND ID = %d", $post_id));
foreach ($getcategories as $categorie) {
switch ($column) {
case 'cat':
echo $categorie->category_name;
break;
}
}
switch ($column){
case 'send';
echo '<input type="submit" class="button button-secondary button-small" name="send_post" value="Verzenden">';
break;
}
}
add_action('init', 'process_send_post');
function process_send_post(){
if($_POST['send_post']) {
echo 'Postelijk';
}
}