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.

Tagged: 

This topic contains 23 replies, has 2 voices.

Last updated by Dražen Duvnjak 10 months ago.

Assisted by: Dražen Duvnjak.

Author Posts
January 31, 2024 at 8:59 am #15247958

nikolaosM

Well since you disabled all the plugins we run the code again and the problem is still there. We deactivated Multilingual Multicurency and the export worked fine, but it exported all the products. This is a problem since we want only the Greek ones. It doesn't have to do with the number of products and how minimal the site is since when the first variable product is found the error occurs. Also we do not have access to the admin panel of the demo site you provided and if we get access, as we said before we need access to public_html folder to insert the custom code and see if it works in your environment.

January 31, 2024 at 10:05 am #15248373

nikolaosM

As we said before, there is no meaning into doing the same thing in another site. The problem is caused by your plugin. IF WE DISABLE THE PLUGIN, THE CODE WORKS. We have lost so much time saying the same thing again and again. Also, the code is the simplest thing on earth. We do simple things, query the products based on their language, get what we want of them and add the data in a CSV file. Simple as that, AND IT WORKS WITHOUT YOUR PLUGIN. Also, we never asked you to troubleshoot the custom code nor to make changes to it in order to work. We want to know what this error is referring to and why is it occurring in order for as to fix it. That's all.

January 31, 2024 at 1:17 pm #15249456

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I understand your side, but I have done my best to answer your doubts in my previous replies.

To proceed further and check why and what happens we need an example reproduced in a simple environment that I shared, that way if it is really a WPML bug we can confirm the issue, debug and provide proper information.

Let me know please how it goes and when can I check the test site.

Regards,
Drazen

January 31, 2024 at 1:42 pm #15249563

nikolaosM

If the problem does not reproduce on your demo site, what will result be? Telling us that you can not solve a problem caused by WPML? Our demo site contains only the WPML plugins and WooCommerce. The only change is that is has more than one products. Give us some advice about what is causing this error and we will try to fix it ourselfs.

January 31, 2024 at 2:01 pm #15249665

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I have shared this ticket and case with our 2nd tier support to check and advise further.

I will update you soon.

Regards,
Drazen

February 1, 2024 at 7:37 am #15253053

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

our 2nd tier checked and is advising you to adapt your custom code, following the following suggestions:

- You loading the WP from external script and calling our internal function direclty.

require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');

global $sitepress;
$sitepress->switch_lang('el');

you need to wrap all the code on some hook so WCML and other plugins can be loaded before calling functions. e.g. init

If first option does not fix the issue, try adding this code in a plugin and then serve the request using query string. e.g. example.com/?load_my_custom_script=1
In plugin file check the query string and print the output.
When you load WP directly many constant variable are missing.

Regards,
Drazen

February 1, 2024 at 4:46 pm #15256035

nikolaosM

Hello,

The code is working after running it through functions.php file. We would like to know if there is a way to have wpml functionality in public_html folder and a custom file, like we are using require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); to have WP functionality available in our custom file.

Thanks!

February 2, 2024 at 7:07 am #15257970

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

great, glad to hear that.

Let me check on this and get back to you.

Regards,
Drazen

February 5, 2024 at 8:57 am #15264703

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

This is not standard practice and not recommended by WP, loading from the custom file.

We can not debug/support this further.

There are many standard alternatives to achieve this.

- Using REST API
- Using query string on root domain as explained above, if YOU like to have normal slug instead of query string, You can redirect the slug to query string using any redirect plugin or can write custom rewrite rules to map to query string.

For any further issue, I suggest hiring or contacting WPML contractors:

- https://wpml.org/contractors/

Regards,
Drazen