Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Our next available supporter will start replying to tickets in about 6.63 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 -
- 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 -

Supporter timezone: Europe/Madrid (GMT+02:00)

Tagged: 

This topic contains 8 replies, has 4 voices.

Last updated by westleyM 1 month ago.

Assisted by: Nigel.

Author Posts
May 8, 2024 at 10:37 am #15605406

martinH-64

Hello! I have a wierd issue when using the WPML GraphQL plugin.

When i do the following query:
contentNode(id: "/underviser/karsten-lund/", idType: URI) {
id
}
i expectedly get the node

but if i do it for the translated version:
contentNode(id: "/en/teacher/karsten-lund/", idType: URI) {
id
}

i get null

May 9, 2024 at 6:28 am #15608617

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
I hope you're doing well.

Before this thread gets assigned to my colleague, I'd like to offer some initial guidance or potential solutions.

In your Query, the language filtering seems missing. Will you please add the language filter by following the guide below and check if you're still having the issue?

- https://wpml.org/documentation/related-projects/wpml-graphql/#language-filtering

While checking in our forum, I also found a ticket where the issue is mostly similar to the one you have reported. if the issue persists even after adding a language filter, please try following the solution mentioned in the ticket below.

- https://wpml.org/forums/topic/unable-to-query-a-post-by-a-slug-with-graphql/

Let us know the update. We will be happy to help if you need further assistance.

Best regards,
Prosenjit

May 21, 2024 at 7:36 am #15648326

martinH-64

Hello!

The "contentNode" root query doesn't have a "language" filter.

It should recieve the node from the specified url.

2 nodes can't have the same url, so you should be able to return the correct node when only given the url, since 2 nodes can't have the same url.

Can you please provide a fix for this?

// Bjørn

Screenshot 2024-05-21 093520.png
May 21, 2024 at 3:06 pm #15651558

Nigel
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi Bjørn

I have been working on this, and I can confirm the problem.

I have been examining the process to see if the workaround for the related issue when querying posts by slug can be adapted for your scenario where you are querying contentNode, but unfortunately it is not possible.

I have added details from this thread to the internal ticket about the related issue so that this can be covered at the same time, and to help bump the priority.

From the comments on the internal ticket it looks like we are expected to do another round of work on the WPML GraphQL plugin fairly soon, and I will let you know when there is an update.

July 8, 2024 at 10:45 am #15912396

martinH-64

Hello Nigel - thank you for your response.
Is there any news regarding this issue? 😊

July 9, 2024 at 4:18 pm #15922083

Nigel
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hello Martin

I didn't see any progress in the internal ticket, so I pinged the developer that this is assigned to, and they said that it is on their list but they have a couple of more urgent tasks that they are currently working on, but that they will move to this as soon as possible.

I'm sorry I don't have anything more specific than that to share with you right now.

September 2, 2024 at 7:55 am #16130289

martinH-64

Hello Nigel, any news regarding this issue? 😊 We have multiple installations, that has this problem, so we would love to have a fix for it soon! 😊

September 2, 2024 at 9:24 am #16130718

Nigel
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi Martin

We recently released 1.1 (and 1.1.1) updates to the GraphQL glue plugin, but unfortunately this specific issue was more complex to resolve than the similar problems and the particular solution for this has been pushed back to the next release (1.2).

I'm subscribed to that internal ticket, and if there is a chance to get a workaround or patch to you ahead of the actual release I will let you know.

I'm sorry I don't have better news for you.

September 9, 2024 at 11:54 pm #16159016

westleyM

+1 on this feature.

@martinh-64 - one thing I ended up doing is querying for something that does support language where arguments. If you do it first, WPML switches the language during the query, and does not switch it back, so subsequent fields you query will also be within the language. This feels like I'm benefitting from a bug, but its a workaround for now.

See attached example:

Screenshot 2024-09-09 at 4.53.39 PM.png