Site icon Hip-Hop Website Design and Development

Get all post IDs from current WP_Query – not just currently visible

I want to get all post IDs from the current query. I know how to get all IDs of the current page using the following:

global $wp_query;
$post_ids = wp_list_pluck( $wp_query->posts, "ID" ); 

This will give me an array of all post IDs, but limited to the current page.

How can I get all IDs but not limited by 'posts_per_page'. (I don’t want to modify the query by changing ‘posts_per_page’.)

I know that there is already information available from the global $wp_query such as:

We will be displaying ” . $wp_query->query_vars['posts_per_page'] . ” posts per page if possible.

We need a total of ” . $wp_query->max_num_pages . ” pages to display the results.

Additional Details:

I am trying to get WooCommerce product IDs and hooking into the woocommerce_archive_description action to do this.