To count the total number of posts that match your query, you can use the found_posts property of the WP_Query object. Here's how you can modify your code to get the total count:

$data = array(
	'post_type'      => 'qqproduct',
	'post_status'    => 'publish',
	'orderby'        => 'DATE',
	'order'          => 'DESC',
	'posts_per_page' => 10,
	'paged'          => $offset,
);

$query = new WP_Query( $data );

$total_count = $query->found_posts;

echo 'Total Found Posts: ' . $total_count;

By accessing the found_posts property of the WP_Query object, you can get the total number of posts that match your query, regardless of the posts_per_page value

this is my query	$data = array		post_type = qqproduct		post_status = publish		orderby = DATE order = DESC		posts_per_page = 10		paged = $offset	;i want to count total found post but it only r

原文地址: https://www.cveoy.top/t/topic/isVa 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录