add_action('frm_after_destroy_entry', 'delete_post_permanently', 20, 2);
function delete_post_permanently($entry_id, $entry){
if($entry->form_id == 25){ // Replace YOUR_FORM_ID with your actual Form ID
$post_id = get_post_meta( $entry->post_id, '_frm_wp_post_id', true );
if($post_id){
wp_delete_post( $post_id, true );
}
}
}
Because I think this may be a timing issue, I suggest you use the frm_before_destroy_action entry. https://formidableforms.com/knowledgebase/frm_before_destroy_entry/
$force_delete = true? Here is my current snippet. My form ID is 25.
add_action('frm_before_destroy_entry', 'delete_post_permanently', 20, 2); function delete_post_permanently($entry_id) { $entry = FrmEntry::getOne($entry_id); if ( $entry->form_id == 25 ) { wp_delete_post( $post_id, true); } }Many thanks, Phil
Please login or Register to submit your answer