bp_docs_create_dummy_doc

Ajax handler to create dummy doc on creation.

Description

bp_docs_create_dummy_doc(); 

Usage

  1. if ( !function_exists( 'bp_docs_create_dummy_doc' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-docs/includes/attachments-ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_docs_create_dummy_doc(); 
  7.  

Defined (1)

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

/includes/attachments-ajax.php  
  1. function bp_docs_create_dummy_doc() { 
  2. add_filter( 'wp_insert_post_empty_content', '__return_false' ); 
  3. $doc_id = wp_insert_post( array( 
  4. 'post_type' => bp_docs_get_post_type_name(),  
  5. 'post_status' => 'auto-draft',  
  6. ) ); 
  7. remove_filter( 'wp_insert_post_empty_content', '__return_false' ); 
  8. wp_send_json_success( array( 'doc_id' => $doc_id ) );