Support » Fixing WordPress » Count all posts made

  • Resolved maerk

    (@maerk)


    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 ‘Count all posts made’ is closed to new replies.