Plugin Settings Import/Export — a practical guide to WordPress plugin import export settings with clear examples you can reuse in real projects.
WordPress Plugin Development Series (65/95). Prefer one article? Read the complete WordPress plugin development tutorial.
Short description
Validate imported JSON schema, check capabilities/nonces, and avoid executing imported PHP.
Export JSON
$settings = get_option('acme_settings', []);
header('Content-Type: application/json');
echo wp_json_encode($settings);
exit;