WP Manifestindependent plugin directory
manifest / developer / wp-json-single-exporter

WP JSON Single Exporter

Export individual posts / CPTs to beautifully formatted JSON — via one-click download or a live REST API endpoint.

by Tanvir Rana Rabbi · github.com/tararauzumaki/wp-json-single-exporter · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/tararauzumaki/wp-json-single-exporter/archive/refs/heads/main.zip

A lightweight, production-ready WordPress plugin that lets administrators export any individual post (including Custom Post Types) to a beautifully formatted JSON file — via one-click download or a live REST API endpoint.

Built for content-heavy sites like anime databases, manga libraries, and movie catalogues where structured data export is essential.


Features

Feature Description
Settings Dashboard Beautiful admin page under Tools → JSON Exporter with tabbed Settings & About views.
Master On/Off Toggle Enable or disable all export functionality without deactivating the plugin.
Per-Post-Type Toggles Choose exactly which post types show export controls via checkbox grid.
Export Field Controls Toggle inclusion of content, excerpt, custom fields, taxonomies, and underscore stripping.
REST API Toggle Enable or disable the public REST endpoint independently.
One-Click Download Download any post as a clean {slug}.json file directly from the admin panel.
Live REST API Public endpoint at /wp-json/custom-export/v1/post/{id} returns structured JSON.
Smart Meta Cleanup Automatically strips hidden system meta keys (anything starting with _).
Image Resolution Resolves the Featured Image ID to its actual full-size URL.
Taxonomy Gathering Detects all attached terms (Categories, Tags, Genres, Studios, etc.) as clean arrays.
Row Actions "Download JSON" link in the admin post list alongside Edit / Trash.
Editor Meta Box Side-panel box with download button and click-to-copy Live API URL.
Settings Link Quick "Settings" link on the Plugins list page.
About Page Developer info, system stats, and plugin description in the About tab.
Secure Nonce verification + capability checks on all admin actions.
DRY Architecture Single shared helper function powers both download and API.
Extensible Filter hooks to customize supported post types and export payload.
Clean Uninstall Removes all plugin options from the database when uninstalled.

Screenshots

Settings Page — Post Type Toggles

Toggle individual post types on or off with a clean checkbox grid UI.

Settings Page — Export Options

Control exactly what data appears in the JSON output with intuitive toggle switches.

About Tab

Developer information, system stats, and plugin description.

Post List — Row Action

A "Download JSON" link appears alongside Edit / Trash for enabled post types.

Editor — Side Meta Box

A styled meta box with a Download button and a read-only API URL field.


Installation

Manual Upload (Recommended for Testing)

  1. Download or clone this repository.
  2. Copy wp-json-single-exporter.php into your wp-content/plugins/ directory.
  3. Go to Plugins → Installed Plugins in your WordPress admin.
  4. Click Activate on WP JSON Single Exporter.
  5. Navigate to Tools → JSON Exporter to configure settings.

From ZIP

  1. Download the latest release .zip file.
  2. In WordPress admin, go to Plugins → Add New → Upload Plugin.
  3. Choose the .zip file, click Install Now, then Activate.

Usage

Configure the Plugin

  1. Go to Tools → JSON Exporter in your WordPress admin.
  2. Settings Tab:
    • Toggle the master switch to enable/disable the plugin.
    • Select which post types should have export controls.
    • Choose which data fields to include in the JSON output.
    • Enable or disable the REST API endpoint.
  3. Click Save Settings.

Download JSON

  • From the post list: Hover over any post and click the Download JSON link.
  • From the editor: Open any post and find the JSON Export meta box in the sidebar. Click Download as JSON.

REST API Endpoint

When enabled, access structured JSON for any post via:

GET /wp-json/custom-export/v1/post/{post_id}

Example:

curl https://yoursite.com/wp-json/custom-export/v1/post/42

Response:

{
  "id": 42,
  "title": "Naruto Shippuden",
  "slug": "naruto-shippuden",
  "post_type": "anime",
  "status": "publish",
  "publish_date": "2025-01-15 10:30:00",
  "modified_date": "2025-03-20 14:22:00",
  "author": "Admin",
  "excerpt": "The continuation of Naruto's journey...",
  "content": "<p>Full HTML content here...</p>",
  "featured_image_url": "https://yoursite.com/wp-content/uploads/naruto.jpg",
  "custom_fields": {
    "episodes": "500",
    "rating": "9.2",
    "status": "Completed"
  },
  "taxonomies": {
    "genre": {
      "label": "Genres",
      "terms": ["Action", "Adventure", "Shounen"]
    },
    "studio": {
      "label": "Studios",
      "terms": ["Pierrot"]
    }
  }
}

Settings Overview

Setting Default Description
Enable JSON Exporter On Master switch — disables all export features when off
Post Types All (none checked) Select specific post types or leave blank for all
Include Content On Include full HTML post content
Include Excerpt On Include the post excerpt
Include Custom Fields On Include all non-system post meta
Include Taxonomies On Include categories, tags, and custom taxonomies
Strip Hidden Meta On Remove meta keys starting with _
Enable REST API On Serve export data via REST endpoint

Advanced Customization

Filter: Supported Post Types

Override the enabled post types programmatically:

add_filter( 'wpjse_supported_post_types', function ( array $types ): array {
    $types[] = 'drama';
    $types = array_diff( $types, array( 'page' ) );
    return $types;
} );

Filter: Export Payload

Modify the JSON output before it is returned:

add_filter( 'wpjse_export_data', function ( array $data, WP_Post $post ): array {
    $data['site_name'] = get_bloginfo( 'name' );
    unset( $data['content'] );
    return $data;
}, 10, 2 );

Security

Mechanism Where
current_user_can( 'edit_posts' ) Download handler + row action visibility
current_user_can( 'manage_options' ) Settings page access
wp_verify_nonce() Download action URL
sanitize_* / absint() All user inputs
esc_url() / esc_html() / esc_attr() All output
register_setting() + sanitize callback Settings save
Public REST endpoint Read-only, no auth required (toggleable)

File Structure

wp-json-single-exporter/
├── wp-json-single-exporter.php   # Main (and only) plugin file
└── README.md                     # This file

Requirements

  • WordPress: 5.6 or higher
  • PHP: 7.4 or higher
  • Permalinks: Must be set to anything other than "Plain" (for REST API)

Changelog

1.0.0 — Initial Release

  • One-click JSON download from post list and editor
  • Live REST API endpoint
  • Smart meta cleanup
  • Featured image URL resolution
  • Taxonomy detection
  • Dynamic post type detection (all show_ui types)
  • Nonce-protected download action
  • Editor meta box
  • Admin settings page under Tools → JSON Exporter
  • Master enable/disable toggle
  • Per-post-type checkbox toggles
  • Export field toggles (content, excerpt, meta, taxonomies, underscore stripping)
  • REST API enable/disable toggle
  • About tab with developer info and system stats
  • "Settings" link on the Plugins list page
  • Clean uninstall — removes all options from database

About the Developer

Tanvir Rana Rabbi


License

This plugin is licensed under the GPL-2.0-or-later.


Contributing

  1. Fork this repository.
  2. Create a feature branch: git checkout -b feature/my-feature.
  3. Commit your changes: git commit -m "Add my feature".
  4. Push to the branch: git push origin feature/my-feature.
  5. Open a Pull Request.

Made by Tanvir Rana Rabbi for the Otaku Bangla community.