register_importer

Register importer for WordPress.

Description

(WP_Error) register_importer( (string) $id, (string) $name, (string) $description, (callable) $callback ); 

Returns (WP_Error)

Returns WP_Error when $callback is WP_Error.

Parameters (4)

0. $id (string)
Importer tag. Used to uniquely identify importer.
1. $name (string)
Importer name and title.
2. $description (string)
Importer description.
3. $callback (callable)
Callback to run.

Usage

  1. if ( !function_exists( 'register_importer' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/import.php'; 
  3.  
  4. // Importer tag. Used to uniquely identify importer. 
  5. $id = ''; 
  6.  
  7. // Importer name and title. 
  8. $name = ''; 
  9.  
  10. // Importer description. 
  11. $description = ''; 
  12.  
  13. // Callback to run. 
  14. $callback = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = register_importer($id, $name, $description, $callback); 
  18.  

Defined (1)

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

/wp-admin/includes/import.php  
  1. function register_importer( $id, $name, $description, $callback ) { 
  2. global $wp_importers; 
  3. if ( is_wp_error( $callback ) ) 
  4. return $callback; 
  5. $wp_importers[$id] = array ( $name, $description, $callback );