Gatsby & WordPress – 5.3. – Increasing WPGraphQL Query Limit

23/11/2019 by Jack Pritchard

In this video, we will increase the maximum queryable nodes returned by a single GraphQL query in WPGraphQL from 100 items to 300+ items.

The current version of WPGraphQL (0.4.1) limits the number of posts you can query from the /graphql endpoint to 100 items.

Even with filter parameters used within a GraphQL query (e.g. first:300), our JSON response will be limited to 100 items.

To get around this issue, we can modify our WordPress theme's functions.php file to increase the GraphQL query limit.

How to do this in a traditional WordPress theme functions.php

add_filter( 'graphql_connection_max_query_amount', function( $amount, $source, $args, $context, $info  ) {
    if ( current_user_can( 'manage_options' ) ) {
         $amount = 1000;
    return $amount;
}, 10, 5 );

How to do this in a timber WordPress theme functions.php

/** Add timber support. */
public function __construct() {
    ...Other WordPress hooks
    add_filter('graphql_connection_max_query_amount', array($this, 'wpgraphql_tweaks'), 10, 5);

public function wpgraphql_tweaks($amount, $source, $args, $context, $info) {
    $amount = 1000;
    return $amount;

Continue Reading 📚