I am trying to: Have a fast website. Serve cached pages without database queries.
Link to a page where the issue can be seen: All pages on hidden link
I expected to see: No database queries after warming object cache.
Instead, I got:
- 231 cache misses, followed by
- 199 cache sets in WPML_URL_Cached_Converter->convert_url(), due to
- 1 invocation of WPML_WPSEO_Redirection::clear_converter_cache_for_home_url()
Apparently the invocation of clear_converter_cache_for_home_url() is hardcoded into WPML_WPSEO_Redirection->is_redirection(), but this is invoked on every page request!
The invocation is commented with the following in your code:
// The unfiltered URL got cached so we need to flush the group.
self::clear_converter_cache_for_home_url();
It is not clear what this is referring to. The function is not filtering or converting any URLs afterwards. There does not seem to be a point in clearing the cache.
Proposed solution: Remove the hardcoded invocation without replacement.
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Hi,
According to our 2nd tier (see this function):
add_filter( 'wpml_skip_convert_url_string', '__return_true' );
$base_url_path = ltrim( wp_parse_url( home_url(), PHP_URL_PATH ), '/' );
remove_filter( 'wpml_skip_convert_url_string', '__return_true' );
// The unfiltered URL got cached so we need to flush the group.
self::clear_converter_cache_for_home_url();
We called home_url() after adding a filter “wpml_skip_convert_url_string” so the unfiltered URL is cached we are clearing the wrong cached URL so the filtered URL can be used on next home_url call.
The use-case was addressed in WPML already. WPML caches the convert_url result separately depending on the chosen "strategy". When `wpml_skip_convert_url_string` is enabled, then a different strategy is applied and thus the result is cached for these invocation parameters only. For that reason, the clearing of the whole cache is obsolete.
In any case – you cannot flush the whole cache of converted URLs. That has terrible ramifications for the performance of all websites using WPML.
Can you remove the cache clearing from the code?
We're doing performance optimizations for various WordPress websites. WPML is standing out as the only plugin that does not behave correctly. Next to the issue mentioned here, WPML is also caching data in custom ways are not meant to be used for cached data (transients and even options) and thus break every standard object cache setup. We will create separate threads for those issues when time permits.
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Hi,
Thank you for going so far in investigating this - this is escalated to our 2nd tier team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you!
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Hi,
This issue has been escalated to WPML developers.
I will keep this thread updated as soon as I get any new information from them!
Regards,
Bruno Kos
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.