Created
June 16, 2015 17:05
-
-
Save jchck/19313691f1c4d2371ce8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @link http://cfxdesign.com/remove-unused-css-from-wordpress-automatically-with-grunt | |
*/ | |
function show_sitemap() { | |
if(WP_ENV === 'development' && 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()) { | |
$the_query->the_post(); | |
$urls[] = get_permalink(); | |
} | |
die(json_encode($urls)); | |
} | |
} | |
add_action('template_redirect', 'show_sitemap'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment