function delete_custom_field() {
    global $wpdb;

    //checking the nonce
    check_admin_referer('delete_custom_field');

    if(  isset($_GET['custom_field_id']) ) {
      $id = (int)$_GET['custom_field_id'];

      if( is_int($id) ){
        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE id = %d",$id );
        $wpdb->query($sql);
      }
    }

    //ToDo: poner mensaje de que se borro correctamente
    wp_safe_redirect(
      add_query_arg(
        'field_deleted',
        'true',
        wp_get_referer()
      )
    );
  }