---
title: "array( &#8216;limit&#8217; => -1, &#8216;status&#8217; => &#8216;publish&#8217; )"
url: "https://www.tarikul.top/wordpress/array-limit-1-status-publish/"
language: "en-US"
updated: "2024-10-02T06:31:45+00:00"
---

# array( &#8216;limit&#8217; => -1, &#8216;status&#8217; => &#8216;publish&#8217; )

$products = wc\_get\_products( array( ‘limit’ => -1, ‘status’ => ‘publish’ ) );

Here’s what each part of the array `array( 'limit' => -1, 'status' => 'publish' )` does:

**`'limit' => -1`**:

This sets the number of products to retrieve. By default, WooCommerce limits the number of products returned (usually to 10 or 12 per query). Setting `'limit' => -1` tells WooCommerce to return **all** products without any limitation.

**`'status' => 'publish'`**:

- This ensures that only **published** products are retrieved. In WooCommerce, products can have different statuses, such as `'publish'`, `'draft'`, or `'pending'`. Using `'status' => 'publish'` ensures that only products that are visible to customers are returned.
