ninja_forms_delete_form

Delete a form.

Description

ninja_forms_delete_form( (string) $form_id = '' ); 

Parameters (1)

0. $form_id — Optional. (string) => ''
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_delete_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/deprecated.php'; 
  3.  
  4. // The form id. 
  5. $form_id = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_delete_form($form_id); 
  9.  

Defined (1)

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

/deprecated/includes/deprecated.php  
  1. function ninja_forms_delete_form( $form_id = '' ) { 
  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_form_capabilities', 'manage_options' ) ) ) 
  10. return false; 
  11.  
  12. if( $form_id == '' ) { 
  13. $ajax = true; 
  14. $form_id = absint( $_REQUEST['form_id'] ); 
  15. check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' ); 
  16. }else{ 
  17. $ajax = false; 
  18.  
  19. Ninja_Forms()->form( $form_id )->delete(); 
  20.  
  21. if( $ajax ) { 
  22. die();