WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Count all posts made

[Resolved] Count all posts made

  • Is there a simple way of getting the number of posts in the database?

    At the moment I’m trying to use:

    $count = $wpdb->get_results('SELECT COUNT(*) FROM wp_posts');

    This isn’t working, because $count stays empty.

    It must return a number, because I’m using this later on:

    $remainder = $count - 10;

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Count all posts made’ is closed to new replies.
Skip to toolbar