Merge pull request #790 from ultimatemember/fix/permanently_delete_fields

Permanently deleting form's field (issue #786)
This commit is contained in:
Nikita Sinelnikov
2021-04-05 13:20:55 +03:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
+8
View File
@@ -257,6 +257,14 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
update_option( 'um_fields', $fields );
}
global $wpdb;
$forms = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'um_form'");
foreach ( $forms as $form_id ) {
$form_fields = get_post_meta( $form_id, '_um_custom_fields', true );
unset( $form_fields[ $id ] );
update_post_meta( $form_id, '_um_custom_fields', $form_fields );
}
}