graphql-wp A GraphQL endpoint for WordPress Exposes a graph ql endpoint at /graphql This is a work in progress / in active development, but already pretty useful. Read only access currently. Uses this excellent graphql-php library. Install composer require thefold/graphql-wp Using The best way to explore / develop with this is by using a tool such as ChromeiQL That will show you the endpoints and arguments that are available. wp_query This is designed to follow WordPress' existing WP Query functions. So as a rule you can pass the same parameters as your can to WP Query*. *In reality there are a lot of params you can pass to WP_Query, and I've only implemented the ones that I've needed so far. But adding more is trivial as the arguments are just passed directly to the get_posts function, so its just a matter of defining them in the schema. {"query":"{ wp_query { posts(paged: 1 posts_per_page: 10) { title name terms (taxonomy:"category") { name slug } } } }"} Will give you { "data": { "wp_query": { "posts": [ { "title": "Much better than REST", "name": "so-easy-yes" "terms": [ { "name": "Example Category ", "slug": "example-category" } ] } ... Also available on wp_query menu {"query":
Share This