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 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

Tagged: ,

This topic contains 11 replies, has 2 voices.

Last updated by Waqas Bin Hasan 1 year, 3 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
February 15, 2024 at 10:43 am #15306436

mateusz-sitarzM

I have a problem with changing the rest url prefix. If I make a change by using the rest_url_prefix hook from 'wp-json' to 'api', the wpml translation orders do not work and the query
api/wpml/tm/v1/jobs/?limit=20&offset=0&sorting%5Bid%5D=desc&pageName=tm-jobs

reports that it does not find routing. Without changing the rest api prefix, everything works fine.

add_filter('rest_url_prefix', function () {
return 'api';
});

February 15, 2024 at 12:29 pm #15306871

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Reference to our recent chat, I am trying to reproduce the issue in a clean install. However, in the meanwhile, are there any particular steps or scenarios which can be helpful in reproducing the said issue?

Please let me know.

Regards.

February 16, 2024 at 5:27 am #15309963

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation. I've escalated the matter to our 2nd tier team for further investigation and 'll update you accordingly.

February 16, 2024 at 11:55 am #15311398

mateusz-sitarzM

Just change the rest api prefix and the error already occurs.

February 16, 2024 at 12:33 pm #15311596

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the update, yes I've found that and have escalated the matter already.

I'll update you as soon as there's a progress.

February 27, 2024 at 2:02 pm #15349461

mateusz-sitarzM

Any news?

February 28, 2024 at 5:27 am #15351802

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Our apologies for the delay but unfortunately there's no ETA so far. The case is with our dev team and they are looking into it among other things.

We'll update you once there's any progress.

March 18, 2024 at 9:07 am #15419709

mateusz-sitarzM

Do you know anything new?

March 18, 2024 at 4:37 pm #15422572

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

My apologies there's still no news on that. However, I am checking with the team that if we can have any temporary solution to that.

I'll get back to you as soon as I hear back.

March 19, 2024 at 4:22 pm #15427556

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting on this, our team has published an errata containing a temporary workaround, please see https://wpml.org/errata/custom-rest-url-prefix-advanced-translation-editor-loading-issue/ and follow along.

Remember to take a fresh backup beforehand.

March 20, 2024 at 12:03 pm #15431084

mateusz-sitarzM

Please explain to me how this will help solve the problem. I use this hook to change the prefix for the entire REST API. And only your plugin has a problem with this.

March 20, 2024 at 6:22 pm #15433395

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

As per the recent discussion, the team suggested that:

> First the user should make sure that the rest prefix is changed before anything is executed. This means loading the logic in a mu-plugin and not just anywhere else.

which is recommended in the errata.

Since you may be using it in your code, like a regular plugin or may be theme's functions.php file, what if you use it in an mu-plugin and it may help about the problem?

If this does not fix it, then start replacing.
1) First in the file: wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/class-wpml-rest-request-analyze.php

2) Then in the file: wp-content/plugins/sitepress-multilingual-cms/classes/REST/RewriteRules.php and then in the file: wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/class-wpml-rest.php

Remember to take full backup before proceeding.

Additionally, the issue is with our dev team, which may take some time, since there's no ETA so far. The above mentioned may give you a temporary solution.

You may also subscribe to the comments on that Errata, about any future updates.

Please let me know if the above mentioned works for you.