The register_importer() WordPress PHP function registers a new importer for WordPress.
Usage
register_importer($id, $name, $description, $callback);
Parameters
$id
(string) – Required. Importer tag. Used to uniquely identify the importer.$name
(string) – Required. Importer name and title.$description
(string) – Required. Importer description.$callback
(callable) – Required. Callback function to run.
More information
See WordPress Developer Resources: register_importer()
Examples
Register a CSV Importer
Register a CSV importer that imports data from a CSV file.
function csv_importer_callback() { // Your CSV importer logic goes here } register_importer('csv-importer', 'CSV Importer', 'Import data from a CSV file', 'csv_importer_callback');
Register a JSON Importer
Register a JSON importer that imports data from a JSON file.
function json_importer_callback() { // Your JSON importer logic goes here } register_importer('json-importer', 'JSON Importer', 'Import data from a JSON file', 'json_importer_callback');
Register an XML Importer
Register an XML importer that imports data from an XML file.
function xml_importer_callback() { // Your XML importer logic goes here } register_importer('xml-importer', 'XML Importer', 'Import data from an XML file', 'xml_importer_callback');
Register a Markdown Importer
Register a Markdown importer that imports data from a Markdown file.
function md_importer_callback() { // Your Markdown importer logic goes here } register_importer('md-importer', 'Markdown Importer', 'Import data from a Markdown file', 'md_importer_callback');
Register a Custom File Format Importer
Register a custom file format importer that imports data from a custom file format.
function custom_importer_callback() { // Your custom importer logic goes here } register_importer('custom-importer', 'Custom Importer', 'Import data from a custom file format', 'custom_importer_callback');