Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing very slow performance on their website. A PHP X-Ray report identified WPML as the root cause. Despite updating WPML from version 4.6.12 to 4.6.13, the issue persisted.
Solution:
We discovered that the slow performance was due to specific theme code in

wp-content/themes/website_international_NEW/functions.php

. The problematic code is a function designed to update the focus keyword for all posts of a certain type on every page load. Here is the code:

// Function to automatically update the focus keyword for all: sights<br />function update_focus_keywords_sights()<br />{<br />    $posts = get_posts(array(<br />        'posts_per_page'    => -1,<br />        'post_type'        => 'sights' //replace post with the name of your post type<br />    ));<br />    foreach ($posts as $p) {<br />        update_post_meta($p->ID, 'rank_math_focus_keyword', strtolower(get_the_title($p->ID)));<br />    }<br />}<br />add_action('init', 'update_focus_keywords_sights');

Removing this code reduced the site's load time from approximately 17 seconds to 4.5 seconds. We recommend removing or optimizing this function to improve performance.

If this solution does not apply to your case, or if it seems outdated, please check the related known issues and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket at WPML support forum.

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 21 replies, has 2 voices.

Last updated by Paola Mendiburu 1 month, 2 weeks ago.

Assisted by: Paola Mendiburu.

Author Posts
August 26, 2024 at 7:13 am

olivierA-13

Background of the issue:
We're experiencing very slow performance on our website and got a confirmation from a PHP X-Ray report that WPML is the root cause. See the report here: hidden link. We already followed countless tutorials to try to optimise it, but it seems it wasn't successful. We currently have version 4.6.12 installed, and an update to 4.6.13 didn't help either.

Symptoms:
Very slow performance on the website.

Questions:
Is there anything we can do to speed up WPML?

August 26, 2024 at 9:32 am
August 28, 2024 at 9:08 am
August 28, 2024 at 9:10 am #16113532

Paola Mendiburu
Supporter

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

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

I just sent you a private message with the information to do the migration. Please let me know when it is completed.

September 3, 2024 at 8:57 am #16134574

olivierA-13

Hello

Unfortunately the migration failed, Cloudways reported this. See attached image...

But what we already have, is an existing setup with a staging site, which is an exact copy of production.
On this site, you can freely edit all the files without impacting production. Would that also work for the investigation?

Thanks and best regards,
Levin

Screenshot 2024-09-03 at 10.54.35.png
September 3, 2024 at 1:27 pm #16135910

Paola Mendiburu
Supporter

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

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

Do you give me permission to download a copy with all in one wp migration?

I would like to test it on another server to check if it is a server related issue.

September 3, 2024 at 1:57 pm #16136049

olivierA-13

Yes, you may download a copy and/or install additional plugins on the staging server. The credentials for it are in this ticket.

September 4, 2024 at 2:56 pm #16141352

Paola Mendiburu
Supporter

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

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

I am on it.

September 5, 2024 at 3:19 pm #16145778

Paola Mendiburu
Supporter

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

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

Do you give me permission to install php andminer on your staging site?
hidden link

I want to check database

September 6, 2024 at 6:38 am #16147340

olivierA-13

Yes, go for it. 🙂

September 9, 2024 at 9:46 am #16154992

Paola Mendiburu
Supporter

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

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

I am on it.

It is taking longer the migration.

Once I will reproduce the issue on migration I will send it to the second tier.

September 10, 2024 at 5:09 pm #16163022

Paola Mendiburu
Supporter

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

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

I am preparing to send it to the second tier.

September 11, 2024 at 9:16 am #16165383

olivierA-13

Okay, thank you Paola. 👍

September 11, 2024 at 10:39 am #16165930

Paola Mendiburu
Supporter

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

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

I have investigated the database I see that icl_sitepress_settings on wp_options and the size is 428.5059

In order to improve performance you can keep it as autoload=no

Please go to your database and on the table wp_options search for icl_sitepress_settings and change it to autoload no.

Also please apply this solution:
https://wpml.org/forums/topic/urgent-icl_sitepress_settings-is-510803-in-length-causing-website-down-time/

Please let me know if after that improves the performance.

September 13, 2024 at 2:51 pm #16176414

olivierA-13

Hi Paola

Thanks for your message.
We followed your recommendations, and set autoload=no for the icl_sitepress_settings option key.
Also, we:

- deleteed wpml_notices
- ran the the Translate Link Targets option under WPML → Settings.
- didn't delete "_wpml_tp_api_logger", as we didn't find this one in the DB.
- cleared WPML logs
- cleared wpml_tp_com_logs from WPML > Support > communication log

Also, we cleared the cache and let it rebuild.

All this but we don't really see an improvement of performance.
Do you have any other recommendations?

Best regards
Levin