Skip to content

Instantly share code, notes, and snippets.

@mostafasoufi
Created September 17, 2017 13:11
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 mostafasoufi/6925a48beb8ade3d27d42d15d35392ca to your computer and use it in GitHub Desktop.
Save mostafasoufi/6925a48beb8ade3d27d42d15d35392ca to your computer and use it in GitHub Desktop.
How get pages stat list with page slug
<?php
global $wpdb, $table_prefix;
$page_slug = '%about%';
$pages = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$table_prefix}statistics_pages` WHERE `uri` LIKE %s", $page_slug ) );
echo '<table border="1"><tr><td>ID</td><td>Count</td><td>Slug</td></tr>';
foreach ( $pages as $page ) {
echo "<tr><td>{$page->id}</td><td>{$page->count}</td><td>{$page->uri}</td></tr>";
}
echo '</table>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment