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

graphql_connection_page_info

Filter the pageInfo that is returned to the connection.

This filter allows for additional fields to be filtered into the pageInfo of a connection, such as “totalCount”, etc, because the filter has enough context of the query, args, request, etc to be able to calcuate and return that information.

Params

  • $page_info (array): Array containing page info
  • $resolver (AbstractConnectionResolver): Instance of the connection resolver

Example

You would want to register a “total” field to the PageInfo type, then filter the pageInfo to return the total for the query, something to this tune: