i need to filter count based on a date and post_status = 'publish', how to write a query to filter, as far as now i have filtered based on date, what is the query need to filter based published post.
$table1 = $wpdb->prefix.'posts'; $sql = 'SELECT COUNT(ID) AS count FROM '.$users_table1.' WHERE DATE(post_date) < "'.date('Y-m-d',time()).'"'; $result = $wpdb->get_var($sql);
iam stuck with this, do anyone know this?