Determines if the variable is a numeric-indexed array.
Parameters
$datamixedrequired- Variable to check.
Return
bool Whether the variable is a list.Source
function wp_is_numeric_array( $data ) {
if ( ! is_array( $data ) ) {
return false;
}
$keys = array_keys( $data );
$string_keys = array_filter( $keys, 'is_string' );
return count( $string_keys ) === 0;
}
View all references View on Trac View on GitHub
Related
| Used by | Description |
|---|---|
WP_REST_Abilities_V1_List_Controller::strip_internal_schema_keywords()wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php | Recursively removes WordPress-internal keywords from a schema. |
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() method. |
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()wp-includes/class-wp-theme-json.php | Given a tree, removes the keys that are not present in the schema. |
get_metadata_default()wp-includes/meta.php | Retrieves default metadata value for the specified meta key and object. |
rest_is_array()wp-includes/rest-api.php | Determines if a given value is array-like. |
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()wp-includes/rest-api/class-wp-rest-server.php | Converts a response to data to send. |
WP_Roles::add_role()wp-includes/class-wp-roles.php | Adds a role name with capabilities to the list. |
wp_count_terms()wp-includes/taxonomy.php | Counts how many terms are in taxonomy. |
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |