I would like to count number of comments after 5 days ago
Question
this is my code, and the result shows always the total number of comments instead of number of comments after 12 february 2020.
I don’t know why it does not working.
#!/usr/bin/php
<?php
if ( ! defined('ABSPATH') ) {
/** Set up WordPress environment */
require_once( dirname( __FILE__ ) . '/wp-load.php' );
}
$args1 = array(
'status' => 'approve',
'date_query' => array(
array (
'after' => '2020-02-12 10:00:00',
),
),
);
$comments = new WP_Comment_Query( $args1 );
$comms = get_comments( $comments );
$nbr = count( $comms );
echo "$nbr"
?>
thank you for your help
0
comments
4 years
2020-02-26T08:38:23-05:00
2020-02-26T08:38:23-05:00 0 Answers
60 views
0
Leave an answer