Title: wp_is_numeric_array
Published: December 9, 2015
Last modified: August 20, 2026

---

# wp_is_numeric_array( mixed $data ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#wp--skip-link--target)

Determines if the variable is a numeric-indexed array.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#description)󠁿

Note! This answers a different question than [array_is_list()](https://developer.wordpress.org/reference/functions/array_is_list/)
and is more flexible to handle situations where some numeric array indices have 
been removed. A numeric-indexed array is only a “list” when the array keys form 
a contiguous range from zero to the highest key.

Example:

    ```php
    true  === wp_is_numeric_array( array( 1, 2, 3, 4 ) );
    false === wp_is_numeric_array( array( 'name' => 'WordPress' ) );

    // All-numeric keys vs. list.
    $above_two   = array_filter( array( 1, 2, 8, 9 ), fn ( $v ) => $v > 2 );
    $above_two === array( '2' => 8, '3' => 9 );
    true       === wp_is_numeric_array( $above_two );
    false      === array_is_list( $above_two );
    ```

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#parameters)󠁿

 `$data`mixedrequired

Variable to check.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#return)󠁿

 bool Whether the variable is a list.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#source)󠁿

    ```php
    function wp_is_numeric_array( $data ): bool {
    	if ( ! is_array( $data ) ) {
    		return false;
    	}

    	return array_all( $data, fn( $value, $key ) => ! is_string( $key ) );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/functions.php#L5383)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/functions.php#L5383-L5389)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#related)󠁿

| Used by | Description | 
| [_wp_prepare_json_schema_for_client_with_allowed_keywords()](https://developer.wordpress.org/reference/functions/_wp_prepare_json_schema_for_client_with_allowed_keywords/)`wp-includes/json-schema.php` |

Prepares a JSON Schema for clients using a given keyword lookup.

  | 
| [wp_cache_switch_to_blog_fallback()](https://developer.wordpress.org/reference/functions/wp_cache_switch_to_blog_fallback/)`wp-includes/ms-blogs.php` |

Fallback logic for switching cache context when an object cache drop-in lacks a [switch_to_blog()](https://developer.wordpress.org/reference/functions/switch_to_blog/) method.

  | 
| [WP_Font_Utils::sanitize_from_schema()](https://developer.wordpress.org/reference/classes/wp_font_utils/sanitize_from_schema/)`wp-includes/fonts/class-wp-font-utils.php` |

Sanitizes a tree of data using a schema.

  | 
| [WP_Theme_JSON::remove_keys_not_in_schema()](https://developer.wordpress.org/reference/classes/wp_theme_json/remove_keys_not_in_schema/)`wp-includes/class-wp-theme-json.php` |

Given a tree, removes the keys that are not present in the schema.

  | 
| [get_metadata_default()](https://developer.wordpress.org/reference/functions/get_metadata_default/)`wp-includes/meta.php` |

Retrieves default metadata value for the specified meta key and object.

  | 
| [rest_is_array()](https://developer.wordpress.org/reference/functions/rest_is_array/)`wp-includes/rest-api.php` |

Determines if a given value is array-like.

  | 
| [rest_filter_response_fields()](https://developer.wordpress.org/reference/functions/rest_filter_response_fields/)`wp-includes/rest-api.php` |

Filters the REST API response to include only an allow-listed set of response object fields.

  | 
| [WP_REST_Server::response_to_data()](https://developer.wordpress.org/reference/classes/wp_rest_server/response_to_data/)`wp-includes/rest-api/class-wp-rest-server.php` |

Converts a response to data to send.

  | 
| [WP_Roles::add_role()](https://developer.wordpress.org/reference/classes/wp_roles/add_role/)`wp-includes/class-wp-roles.php` |

Adds a role name with capabilities to the list.

  | 
| [wp_count_terms()](https://developer.wordpress.org/reference/functions/wp_count_terms/)`wp-includes/taxonomy.php` |

Counts how many terms are in taxonomy.

  |

[Show 5 more](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_is_numeric_array/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_is_numeric_array%2F)
before being able to contribute a note or feedback.