• Resolved ogwebchef

    (@ogwebchef)


    Hi everyone,

    Hope your doing well. First of all this plugin is awesome but having an issue where I can query the first 100+ of just about any data but for querying menus I can only get up to ten items at a time. Is this a good ole’ wordpress limit? If yes, is there a workaround?

    This worked perfectly for posts but not the menus: https://www.devtwins.com/blog/wpgraphql-increase-post-limit

    Looking forward to your response(s).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ogwebchef

    (@ogwebchef)

    Thread Starter ogwebchef

    (@ogwebchef)

    Hi again,

    I managed to find a workaround and thought I’d share it with the community.

    If anyone else has any suggestion to final solution or alternative feel free to share it.

    Main menu items will be managed by WordPress Backend > Appearance > Menus and all remaining items I have created a parent page and sub-pages assigned to parent with specific keywords assigned to parent/sub pages.

    From there I created the following sample query which works for me

    {
      pages(
        where: {search: "random keyword", parent: "1", orderby: {field: MENU_ORDER, order: DESC}}
        first: 11
      ) {
        nodes {
          title
          parentId
          slug
        }
      }
    }

    This will query 10+ pages and return page title, parentid and slug which is perfect for my case use in making a nav menu with more than ten items.

    Hope this helps someone!

    Edit: After replying, looked deeper into my previous queries and found a much more easier solution.

    See query below:

    query graballmenuitems {
      menus(where: {id: 1}) {
        edges {
          node {
            menuItems(first: 11) {
              edges {
                node {
                  label
                }
              }
            }
          }
        }
      }
    }
    • This reply was modified 2 years, 5 months ago by ogwebchef.
    • This reply was modified 2 years, 5 months ago by ogwebchef. Reason: typos
    • This reply was modified 2 years, 5 months ago by ogwebchef. Reason: Found a simpler solution
    • This reply was modified 2 years, 5 months ago by ogwebchef. Reason: bold edit
    Thread Starter ogwebchef

    (@ogwebchef)

    proper query

    query graballmenuitems {
      menus(where: {id: 32}) {
        edges {
          node {
            menuItems(first: 11) {
              edges {
                node {
                  label
                  uri
                }
              }
            }
          }
        }
      }
    }
    • This reply was modified 2 years, 5 months ago by ogwebchef.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘query limits for menus’ is closed to new replies.