So, I started to experiment with a GraphQL plugin for WP, and was wondering how it'd work with Pods.

I came across a question on that plugin's GitHub that's pretty much the same thought I had. The maintainers supplied an answer:

Each Custom Post Type and Custom Taxonomy you want to add to the Schema should have the following fields set:

  • show_in_graphql (bool)

  • graphql_single_name (string)

  • graphql_plural_name (string)

I think I know how to do it with directly creating a custom post type register_post_type() in PHP, but not sure how I'd do it in Pods.


You can definitely add filters for pods_register_post_type_{your_pod} and pods_register_taxonomy_{your_pod}. I'd love to build in support for GraphQL into Pods itself at some point. Just a matter of adding the checks if GraphQL is available and showing the options in the UI, similar to how we do our REST API options in the UI.

add_filter( 'pods_register_post_type_mycpt', 'add_pods_graphql_support' );
add_filter( 'pods_register_taxonomy_mytax', 'add_pods_graphql_support' );

function add_pods_graphql_support( $options ) {

    $options['show_in_graphql'] = true;
    $options['graphql_single_name'] = $options['labels']['name'];
    $options['graphql_plural_name'] = $options['labels']['singular_name'];

    return $options;

  • Thank you! Was not expecting an answer from the maintainer :) I tried it out, and it seems adding the support (via $options['show_in_graphql'] = true;) does something, but breaks something on the GraphQL plugin side. I'll have to look into it! – Robert Dundon Nov 29 '17 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.