Skip Navigation

[Resuelto] Register Post Type Args for WPGraphQL…

This support ticket is created hace 1 año, 9 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por shawnW-3 hace 1 año, 9 meses.

Asistido por: Minesh.

Autor
Mensajes
#2551319

Tell us what you are trying to do?

Not sure why this wouldn't work for Toolset Custom Post Types (specifically)...

add_filter( 'register_post_type_args', function( $args, $post_type ) {
if ( 'model' === $post_type ) {
$args['show_in_graphql'] = true;
$args['graphql_single_name'] = 'Model';
$args['graphql_plural_name'] = 'Models';
}

return $args;

}, 10, 2 );

Toolset CPT:
Name plural = Models
Name singular = Model
Slug = model

Is there any documentation that you are following?

We have looked at other posts concerning register_post_type_args and wpcf-post-type but no more clarity.

Is there a similar example that we can see?

A whole package like this shouldn't be necessary in our case, but here's how someone else managed to hook on to the expose rest settings:
enlace oculto

One concern I have about that is the age of the addon. WPGraphQL is an actively developed plugin.

Here is GraphQL's documentation:
enlace oculto

Please note that we're not looking for custom programming, but to understand why Toolset wouldn't work with this where others would.

#2551767

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I'm not aware about hooking those extra arguments to post type for graphSQL.

I would like to know here - is the model post type is created using Toolset?
what if you try to use the later priority for example 30 or more or 99 with your hook.

For example:

add_filter( 'register_post_type_args', function( $args, $post_type ) {
if ( 'model' == $post_type ) {
$args['show_in_graphql'] = true;
$args['graphql_single_name'] = 'Model';
$args['graphql_plural_name'] = 'Models';
}

return $args;

}, 99, 2 );
#2551805

BRILLIANT! Hadn't even occurred to me, but yes, the priority was the issue. Thank you!