Homepage
Link to WPGraphQL on Github
Link to WPGraphQL on WordPress.org

graphql_dataloader_pre_get_model

This filter allows the model generated by the DataLoader to be filtered. Returning anything other than null here will bypass the default model generation for an object.

One example would be WooCommerce Products returning a custom Model for posts of post_type “product”.

Params

  • $model (null|Model): The filtered model to return. Default null
  • $entry (mixed): The entry loaded from the dataloader to be used to generate a Model
  • $key (mixed): The Key used to identify the loaded entry
  • $loader (AbstractDataLoader): The AbstractDataLoader instance