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

Last updated by thomasA-35 1 year, 11 months ago.

Assisted by: Ahmed Mohammed.

Author Posts
June 20, 2023 at 6:11 pm #13862481

thomasA-35

We are experiencing problems with slow load times on our site. To find the issue, we used the plugin "Code Profiler Pro", which shows PHP load times per plugin/class/function.

The profiler shows that WPML seems to be responsible for a large portion of processing time, specifically the class DebugBackTrace. The second screenshot shows function calls sorted by processing time with the top 6 coming from WPML.

Is there something that can be done about this? There are some other forum entries that seem to point to the same issue, but no solution is provided apart from changing hosting provider.
https://wpml.org/forums/topic/wpml-is-causing-3-75s-loading-time-slow-performance/

Thanks!

Bildschirmfoto 2023-06-20 um 19.58.23.png
Bildschirmfoto 2023-06-20 um 19.57.56.png
June 21, 2023 at 5:57 pm #13870805

Ahmed Mohammed
Supporter

Timezone: Africa/Cairo (GMT+03:00)

Hi Thomas,

Thank you for contacting WPML support!

I have read and watched the videos from the ticket you shared (thank you a lot for sharing it).

According to the code profiler plugin's author, the graph is expected as you have multiple plugins using Composer, and WPML is the first plugin to be loaded, which means that it will be used to load the scripts and classes of all other plugins on your website. And since the whole work is performed by WPML, the profiler assigns the execution time to it.

I'm referring to this reply: https://wpml.org/forums/topic/wpml-is-causing-3-75s-loading-time-slow-performance/#post-11938259 - please correct me if I understood incorrectly.

In regards to the second screenshot, it appears that the DebugBackTrace class is taking up approximately 0.87 seconds, which is not a significant amount of time considering its intended function as described in this reply: https://wpml.org/forums/topic/wpml-is-causing-3-75s-loading-time-slow-performance/#post-11955217.

With that said and after reviewing your website, I have noticed that older versions of WPML plugins are being used in conjunction with newer PHP versions. To enhance performance, it is recommended that you update WPML to the latest versions after backing up your website files and database.

Hope that helps 🙂

June 22, 2023 at 10:32 am #13875475

thomasA-35

Hi Ahmed,

thank you for your reply.

Yes the code profiler plugin has a limitation when it comes to measuring composer dependencies. However, in our case the first plugin that is executed is not WPML, but Query Monitor. So any excessive measurements are counting towards Query Monitor:

Code Profiler has detected that the following components, sorted by execution order, are using Composer dependency manager:
1: Query Monitor, 2: WPML Multilingual CMS, 3: WooCommerce PayPal Payments, 4: Yoast SEO, 5: WPML String Translation, 6: Yoast Test Helper.
As that may increase the execution time of Query Monitor, make sure to consult the following FAQ

I would call nearly 1 second of execution time very significant, especially when it is affecting every frontend page.

You are right, we were not on the latest plugin version. I just updated them in our test environment and the issue remains the same.

I appreciate you looking into this 🙂

June 22, 2023 at 6:04 pm #13880233

Ahmed Mohammed
Supporter

Timezone: Africa/Cairo (GMT+03:00)

Hi Thomas,

Thank you for letting me know about the Query Monitor plugin.

We need to take a deeper look into your website. I request temporary access (wp-admin and FTP) to your site to take a better look at the issue.

You will find the needed fields below the comment area when you log in to leave your next reply. The information you will enter is private, meaning only you and I can see and access it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved, I will delete the local site. Let me know if this is ok with you.

IMPORTANT

- Please backup site files and database before providing us access.
- If you do not see the wp-admin/FTP fields, your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box.

The private box looks like this:
hidden link

Looking forward to hearing back from you.

June 23, 2023 at 1:13 pm #13884717

Ahmed Mohammed
Supporter

Timezone: Africa/Cairo (GMT+03:00)

Hi Thomas,

Thank you for providing the login credentials.

I've forwarded the ticket to our second-tier support team and will keep you informed once I receive their response.

July 4, 2023 at 8:37 am #13938125

Ahmed Mohammed
Supporter

Timezone: Africa/Cairo (GMT+03:00)

Hi Thomas,

I have heard back from our second tier support team as follows:

- There's custom code in wp-content\themes\atom_vasalat\template-parts\header-regular.php that is calling all parent categories (There are 1000 terms) and then looping through them to get all children using a recursive function:

$main_categories = atom_get_product_categories();

        function atom_shop_categories_menu_recursive($category) {

            $sub_categories = get_categories(array(
                'taxonomy'      => 'product_cat',
                'hide_empty'    => true,
                'parent'		=> $category->term_id
            ));
            $is_active = false; // ($active_category == $category->slug || in_array($active_category, array_column($sub_categories, 'slug')));
            if (!empty($sub_categories)) {

                echo '<li class="dropdown">';
                echo '<a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link' . (($is_active) ? ' active' : '') . '">' . $category->name . '</a>';
                echo '<ul class="dropdown-menu">';
                echo '<li class="w-100"><a class="nav-link parent-category" href="' . get_category_link($category->term_id) . '">' . $category->name . ' Übersicht</a></li>';
                foreach ($sub_categories as $sub_category) {
                    atom_shop_categories_menu_recursive($sub_category);
                }
                echo '</ul>';
                echo '</li>';

            } else {

                echo '<li><a class="nav-link" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';

            }

        }

This code adds the 60% website loading time and it happens on all pages as this is in the header to build the menu.

With WPML, this becomes slower because we have code to translate the terms. We have a ticket in our development queue to improve this, but that custom theme should be optimized and use caching/transient to avoid constructing a menu on all requests.

So the steps to be followed:

- Deactivate query monitor and debug bar plugins. These are adding too much overhead to the page load.
- Update W3 Total Cache to the latest version. We saw a good performance boost after the update.
- Improve the above mentioned code with caching technique. https://developer.wordpress.org/reference/classes/wp_object_cache/ https://developer.wordpress.org/apis/transients/

Hope that helps 🙂