thand target * lists keyed by different fields. Casting to string keeps numeric * identities matching whether they arrive as an int or a string. Anything * else (e.g. a nested list) has no identity and never matches, so it is * always appended. * * @since 7.1.0 * * @param mixed $item The list member. * @return string|null The identity, or null when the member has none. */ private function list_item_identity( $item ) { if ( is_scalar( $item ) ) { return (string) $item; } if ( is_array( $item ) && ! array_is_list( $item ) ) { foreach ( array( 'id', 'slug', 'field' ) as $key ) { if ( isset( $item[ $key ] ) && is_scalar( $item[ $key ] ) ) { return (string) $item[ $key ]; } } } return null; } }