Skip to content

Instantly share code, notes, and snippets.

@Viper007Bond
Created August 21, 2012 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Viper007Bond/3419572 to your computer and use it in GitHub Desktop.
Save Viper007Bond/3419572 to your computer and use it in GitHub Desktop.
WordPress Stats
<?php
require_once( 'wp-load.php' );
$data = array(
'posts' => wp_count_posts( 'post' )->publish,
'pages' => wp_count_posts( 'page' )->publish,
'categories' => wp_count_terms( 'category' ),
'tags' => wp_count_terms( 'post_tag' ),
'comments' => wp_count_comments()->approved,
'attachments' => wp_count_posts( 'attachment' )->inherit,
);
$output = "<ul>\n";
foreach ( $data as $label => $value )
$output .= "\t<li>" . number_format( $value ). " $label</li>\n";
$output .= '</ul>';
echo '<pre>' . esc_html( $output );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment