Skip to content

Instantly share code, notes, and snippets.

Created April 13, 2014 14:25
  • Star 34 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Grunt Sitemap Generator plugin for Wordpress
* Plugin Name: Grunt Sitemap Generator
* Plugin URI:
* Description: Generate a JSON list of every page on a site so it can be used with grunt and uncss. Create a folder in /wp-content called mu-plugins, and drop this code into that folder, as grunt-sitemap.php
* Author: Liam Gladdy
* Author URI:
* Version: 1.0
function show_sitemap() {
if (isset($_GET['show_sitemap'])) {
$the_query = new WP_Query(array('post_type' => 'any', 'posts_per_page' => '-1', 'post_status' => 'publish'));
$urls = array();
while ($the_query->have_posts()) {
$urls[] = get_permalink();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment