# 0184-filters-graphql-model-prepare-fields

<!--
This file is auto-generated by scripts/hooks/generate-hook-docs.js.
Do not edit manually.
-->
---
title: graphql_model_prepare_fields
hookType: filter
hookGroup: models
plugin: wp-graphql
---

# graphql_model_prepare_fields

```php
apply_filters( 'graphql_model_prepare_fields', $this->fields, $this->get_model_name(), $this->data, $this->visibility, $this->owner, $this->current_user );
```

Filter the array of fields for the Model before the object is hydrated with it

- **Type:** filter
- **Group:** Model Layer
- **Since:** 1.7.0
- **Source File:** `plugins/wp-graphql/src/Model/Model.php`

## Parameters

- `$fields` (`array<string,mixed>`): The array of fields for the model
- `$model_name` (`string`): Name of the model the filter is currently being executed in
- `$data` (`TData`): The un-modeled incoming data
- `$visibility` (`string`): The visibility setting for this piece of data
- `$owner` (`?int`): The user ID for the owner of this piece of data
- `$current_user` (`\WP_User`): The current user for the session

## Source

- [`plugins/wp-graphql/src/Model/Model.php:537`](https://github.com/wp-graphql/wp-graphql/blob/main/plugins/wp-graphql/src/Model/Model.php#L537)

```php
apply_filters( 'graphql_model_prepare_fields', $this->fields, $this->get_model_name(), $this->data, $this->visibility, $this->owner, $this->current_user );
```

## Related

- `Model::prepare_fields()` in [`plugins/wp-graphql/src/Model/Model.php:537`](https://github.com/wp-graphql/wp-graphql/blob/main/plugins/wp-graphql/src/Model/Model.php#L537)