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.
This topic contains 21 replies, has 2 voices.
Last updated by 3 weeks, 6 days ago.
Assisted by: Paola Mendiburu.