WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Need Way to Track Monthly Posts by Author (6 posts)

  1. evilbeet
    Member
    Posted 4 years ago #

    I'm looking for a plugin that will allow me to tell how many posts each one of my authors/editors/etc has published each month. I've looked around for one and not had any luck finding one. Can someone recommend such a plugin?

    If not, I'd appreciate suggestions for how I can use the SQL database to extract this data. What would be the appropriate query?

    Thanks in advance!

  2. evilbeet
    Member
    Posted 4 years ago #

    Just thought I'd try a bump?

  3. MichaelH
    Member
    Posted 4 years ago #

    Using wpdb with something like this will get you close

    $mytitles = $wpdb->get_results("
    SELECT COUNT(*), $wpdb->posts.post_author,YEAR($wpdb->posts.post_date), MONTH($wpdb->posts.post_date)
    FROM $wpdb->posts
    WHERE 1=1
    AND $wpdb->posts.post_type = 'post'
    AND $wpdb->posts.post_status = 'publish'
    GROUP BY $wpdb->posts.post_author, LEFT($wpdb->posts.post_date, 7)
    ");

  4. MichaelH
    Member
    Posted 4 years ago #

    Cleaned up a bit--didn't test this too much:

    <?php
    $results = $wpdb->get_results("
    SELECT COUNT(*), $wpdb->posts.post_author,YEAR($wpdb->posts.post_date), MONTH($wpdb->posts.post_date)
    FROM $wpdb->posts
    WHERE 1=1
    AND $wpdb->posts.post_type = 'post'
    AND $wpdb->posts.post_status = 'publish'
    GROUP BY $wpdb->posts.post_author, LEFT($wpdb->posts.post_date, 7)
    ",ARRAY_N);
     foreach ($results as $result) {
      echo '<p>author id '.$result[1] . ' has '.$result[0] . ' posts in '.$result[3] . '/'.$result[2] . '</p>';
      }
    
    ?>
  5. evilbeet
    Member
    Posted 4 years ago #

    This worked!!! Thank you thank you!!!! And THANK YOU again!!

  6. ameenullah
    Member
    Posted 3 years ago #

    I am also looking for the same. Where can i paste this code to get it done. need to create a new file? or add it in function.php?
    thanks in adv.

    any suggestion, if i can plug it to dashboard. how can i?

Topic Closed

This topic has been closed to new replies.

About this Topic