Guest User

Untitled

a guest
Dec 13th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. function posts_per_day_by_authorid( $userid, $post_type, $year, $month, $day ) {
  2. $query = new WP_Query( array(
  3. 'author' => $userid,
  4. 'post_type' => $post_type,
  5. 'date_query' => array(
  6. array(
  7. 'year' => $year,
  8. 'month' => $month,
  9. 'day' => $day,
  10. ),
  11. ),
  12. 'posts_per_page' => -1,
  13. ));
  14. $count = $query->post_count;
  15. return $count;
  16. }
  17.  
  18. echo posts_per_day_by_authorid( '1', 'post', '2018', '12', '13' );
  19.  
  20. <?php
  21.  
  22. $path = $_SERVER['DOCUMENT_ROOT'];
  23. require_once $path . '/wp-load.php';
  24. global $wpdb;
  25.  
  26. function posts_per_day_by_authorid( $userid, $post_type, $year, $month, $day ) {
  27. $query = new WP_Query( array(
  28. 'author' => $userid,
  29. 'post_type' => $post_type,
  30. 'date_query' => array(
  31. array(
  32. 'year' => $year,
  33. 'month' => $month,
  34. 'day' => $day,
  35. ),
  36. ),
  37. 'posts_per_page' => -1,
  38. ));
  39. $count = $query->post_count;
  40. return $count;
  41. }
  42.  
  43. echo posts_per_day_by_authorid( '1', 'post', '2018', '12', '13' );
  44.  
  45. ?>
Add Comment
Please, Sign In to add comment