WC_Query::get_current_posts()protectedWC 1.0

Get the posts (or the ids of the posts) found in the current WP loop.

Method of the class: WC_Query{}

No Hooks.

Return

Array. Array of posts or post ids.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_current_posts();

WC_Query::get_current_posts() code WC 8.7.0

protected function get_current_posts() {
	return $GLOBALS['wp_query']->posts;
}