ninja_forms_remove_field

The Ninja Forms ninja forms remove field function.

Description

ninja_forms_remove_field(); 

Usage

  1. if ( !function_exists( 'ninja_forms_remove_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_remove_field(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/admin/ajax.php  
  1. function ninja_forms_remove_field() { 
  2. global $wpdb; 
  3.  
  4. // Bail if we aren't in the admin 
  5. if ( ! is_admin() ) 
  6. return false; 
  7.  
  8. // Bail if we don't have proper permissions 
  9. if ( ! current_user_can( apply_filters( 'nf_delete_field_capabilities', 'manage_options' ) ) ) 
  10. return false; 
  11.  
  12. check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' ); 
  13.  
  14. $field_id = absint( $_REQUEST['field_id'] ); 
  15. $form_id = absint( $_REQUEST['form_id'] ); 
  16. $wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id)); 
  17. Ninja_Forms()->form( $form_id )->dump_cache(); 
  18. die();