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
. 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.
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?
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 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?