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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 5:00 – 13:00 5:00 – 13:00 5:00 – 13:00 5: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: America/Argentina/Buenos_Aires (GMT-03:00)

Tagged: 

This topic contains 9 replies, has 1 voice.

Last updated by Otto 3 weeks, 3 days ago.

Assisted by: Otto.

Author Posts
April 20, 2025 at 6:21 pm #16950180

christophL-4

Background of the issue:
Ich versuche, einen Sprachumschalter-Block in einer Blockvorlage auf Englisch einzufügen. Die Hauptsprache ist Deutsch. Ich verwende die Vorlage: twentytwentyfour.

Symptoms:
Wenn ich den Sprachumschalter-Block einfüge und auf die Schaltfläche Speichern/Aktualisieren klicke, erhalte ich die Fehlermeldung 'Speichern fehlgeschlagen.'

Questions:
Warum erhalte ich die Fehlermeldung 'Speichern fehlgeschlagen', wenn ich den Sprachumschalter-Block einfüge?
Gibt es bekannte Probleme mit dem WPML-Plugin und dem twentytwentyfour-Theme?

April 20, 2025 at 6:40 pm #16950204

christophL-4

I noticed also, that this problem is not related to the language switch, if I change something on the english template page, i get a "Invalid JSON response" error.

In the browser error console i get the message "{"code":"rest_post_invalid_id","message":"Invalid post ID.","data":{"status":404}}".

So, there is something wrong with the WPML settings and WordPress block themes.

What can I do?

InsertLanguageSwitchBlock-SaveError.jpg
InvalidJSON-Response.jpg
April 21, 2025 at 11:53 am #16951785

christophL-4

I tested this problem also in a clean, empty WordPress installation, only WPML activated.

The same happens, if i try to save the edited EN template:
JavaScript/Rest API error "hidden link"

I think now about this: this REST API URL is using "/en/" because i try to edit the english template. Maybe "hidden link" is simply just not registered in WPML?

I translated the template-part "header" in the WPML menu "Translation Managment" (just copied the markup of DE into the translation window of EN). That doesn't help.

Is there a way to set up the REST API with WPML correctly?

April 23, 2025 at 12:34 pm #16959700

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I apologize for the delay in responding. I will take care of this ticket; the reply time will be shorter now.

If you try with the Twenty Twenty Five theme the issue persist?

The Rest Api should work out of the box with WPML. WPML uses it internally for many things.

Can you please copy here the full error that you get in the browser's console when trying to save?

Also, please follow the instructions mentioned on this page: https://wpml.org/documentation/support/debugging-wpml/
Then, try to reproduce the issue and check your installation's **wp-content** folder to see if a file named **"debug.log"** was created (it will only be generated if a server error occurs).
If the file was created, please upload it to a platform like **Google Drive** or **Dropbox** (whichever you usually use) and share the link with me (make sure it is publicly accessible) so I can analyze it.

Best Regards,
Otto

April 23, 2025 at 2:27 pm #16960551

christophL-4

Hey Otto, thanks for your response.

The error also happens with twentytwentyfive theme. See the attached image, the image explains which steps i took until the error appeared.

The exact error message is:
"hidden link" 404 Not found

If i alter something in the german verson - which works without any error - of the header, the url might me:
hidden link -> WITHOUT "/en/"

So, there is maybe a problem with the /en/-URL? Is there some setting in WPML i should make?

I gueass WPML is parsing the template, template-parts, and patterns directories, but fails with a kind of "registering" - and the REST API URL above (with /en/) remains unknown.

Analyzing the header-related coded reveals this:

Content of themes/twentytwentyfive/parts/header.html:
<!-- wp:pattern {"slug":"twentytwentyfive/header"} /-->
(This code loads the pattern "header.php" from patterns directory)

Content of themes/twentytwentyfice/patterns/header.php
<!-- wp:group {"align":"full","layout":{"type":"default"}} -->
<div class="wp-block-group alignfull">
<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-top:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30)">
<!-- wp:site-title {"level":0} /-->
<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"right"}} -->
<div class="wp-block-group">
<!-- wp:navigation {"overlayBackgroundColor":"base","overlayTextColor":"contrast","layout":{"type":"flex","justifyContent":"right","flexWrap":"wrap"}} /-->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->

Since block-themes relays greatly on HTML markup and the entries in themes.json - is there some code related to WMPL missing?

wpml_settings_translation_of_post_types.jpg
twentytwentyfive_same error.jpg
April 23, 2025 at 3:58 pm #16961246

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thanks.

I am not able to reproduce the problem.

Can you please help me with that? I created a clean installation of WordPress, WPML, and all necessary WPML add-ons.
You can access the WordPress dashboard using the link below:
hidden link

Kindly follow the steps below:

- Don't restore your site there.
- Try to replicate the issue with minimal steps.
- Then let me know the steps to see the problem.

Best Regards,
Otto

April 23, 2025 at 6:12 pm #16961732

christophL-4

Wow, Otto, thanks a lot for the sandbox installation.

You're right, the problem doesn't happens in your sandbox. I compared also the WPML settings, they are equal to my WPML-Settings.

I installed also WPML string translation, as it is on the sandbox installed, no result.

However, there is an issue in the Server-Request-Headers, please see my attached image below.

My response header "link" is the URL WITHOUT EN, but the URL with EN is requested, the sandbox request headers are fine, the request URL and the header link URL are the same.

I am running the installation locally with xampp, Apache and MySQL.

I don't know what to do now. Have you any idea why the request header link differs from the requested URL???

For the moment, i switch to a hybrid theme (means a classiv theme which is using patterns), that is more hassle-free. Perhaps the problem doesn't occur on a remote server, but I want to test and develop locally.

Comparison_Network.jpg
April 23, 2025 at 6:33 pm #16961771

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Yes, it looks related to your local environment in some way.

Maybe you can give a try to this tool:
hidden link

I use it for testing purposes, and it works well with WPML.

Best Regards,
Otto

April 23, 2025 at 6:54 pm #16961790

christophL-4

😮

Don't do this to me! :-)))

I work now over many years with xampp... using block themes with WPML is for me a very special use case, so I try to stick to xampp. Other tools, other errors. No thank you.

Btw. hybrid themes have some advantages for me. I like the old way to build menus. I can create a custom menu walker with PHP - for block themes you have to build a new Gutenberg block i guess, an this is rather complicated...

So, thanks for your help, so far. I don't have the time to dig into the local environment issue now, perhaps later.

I can not mark the issue as resolved. Since the post is visible to the community, perhaps someone has an idea...

April 23, 2025 at 7:57 pm #16961966

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Sure, I understand 🙂

I can take a look if you provide me with a copy of your site. Please use Duplicator, WP All in One Migration, or Updraft Plus plugins to do the copy.

I'll give it a try in my local environment.

You'll need to provide me with a download link, you won't be able to upload it.

I am enabling a private in case you want me to take a look.

Best Regards,
Otto

April 24, 2025 at 1:07 pm #16964587

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

I deployed your site locally, and I managed to save a page (including a language switcher) and the header itself.

So, it seems to be related to your local environment.

Let me know if you need anything else from our end.

Best Regards,
Otto

April 24, 2025 at 4:36 pm #16965503

christophL-4

Dear Otto, thanks for your help. Ok, i will later dig further into this topic. Perhaps I found the culprit, i will post this then immediately here.

Perhaps leave the thread as unsolved, maybe someone else has an idea, besides of my efforts to find the problem.

Regards

Christoph

April 24, 2025 at 5:48 pm #16965772

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

You are welcome 🙂

The ticket will remain open for two weeks without activity.

But, after that period, it will still be visible, and anybody will be able to post.

After 2 years, it will be archived.

Best Regards,
Otto

The topic ‘[Closed] Block Theme: saving header with inserted WPML language switch block cause saving error/is not saved.’ is closed to new replies.