Co-Authors Plus
[resolved] How to get Statistics of co-authors posts from DB (2 posts)

  1. Minh Tran
    Posted 3 years ago #

    I often have guest posts on my sites and some of co-authors articles. How can I count the number of co-authors posts separately from single-author posts.

    For single-author posts I often use the following code:

    get_var("SELECT COUNT(*) FROM $wpdb->posts
    WHERE post_status = 'publish' AND post_type = 'post'
    AND post_author = '8'
    AND MONTH(post_date) = $this_month
    AND YEAR(post_date) = $this_year");

    How about co-author posts?

    I have looked up the tables at wp_posts vĂ  wp_postmeta but it's still show only one author (main author) for this post

    Thank you if anyone has solution.


  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 3 years ago #

    Sorry for the late reply. You'll need to calculate posts with one coauthor term verus those with more than one co-author term. You should be able to do this by iterating through all of your posts, then doing get_coauthor() for each post, and counting how many authors are returned.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.