您完全可以为添加过滤器pods_register_post_type_{your_pod}
和pods_register_taxonomy_{your_pod}
. 我很乐意在某个时候将对GraphQL的支持构建到Pods本身中。只需添加GraphQL是否可用的检查,并在UI中显示选项,类似于我们在UI中执行REST API选项的方式。
<?php
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;
}