WordPress JSON Sitemap Generator

WordPress JSON Sitemap Generator
View on GitHub

Packagist

A WordPress plugin that generates a JSON sitemap on non-production environments - for use with UnCSS as a PostCSS plugin. Visit:

http://yourdomain.com?json_sitemap

Sitemap

The JSON sitemap includes:

  • Single posts
  • Pages
  • Single CPT’s
  • Author archives
  • Term archives
  • CT term archives
  • Monthly archives

Plus, these special pages:

  • Empty search results page
  • Search results page with no results
  • Search results page with pagination
  • 404 page

Requirements

You’ll need to have WP_ENV defined in your WordPress config.

WP_ENV must be defined as the current environment:

define('WP_ENV', 'development');

If you use Bedrock, WP_ENV is already defined in the config.

Installation

If you’re using Composer to manage WordPress, add json-sitemap to your project’s dependencies:

composer require h-enk/json-sitemap

Or manually add it to your composer.json:

"require": {
  "php": ">=5.6",
  "johnpbloch/wordpress": "4.9.4",
  "h-enk/json-sitemap": "^1.0"
}

Usage

Visit:

http://yourdomain.com?json_sitemap

Credits

Inspired by JSON Sitemap Generator for Grunt-UnCSS with WordPress.