Background of the issue:
I am trying to ensure that the viewport tag is correctly recognized and processed by various tools, including Google PageSpeed Insights. Link to a page where the issue can be seen: hidden link
Symptoms:
Despite the viewport tag being present in the source code, Google PageSpeed Insights and other tools are not recognizing it correctly. This is causing issues with the reported mobile optimization and overall page performance.
Questions:
Why is the viewport tag not being recognized by Google PageSpeed Insights and other tools?
How can I ensure the viewport tag is correctly detected and processed?
before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps to help speed up the support process.
I don't see how this issue is related to WPML, as your example refers to your default language, which isn't controlled by WPML. Does the issue persist if WPML is temporarily deactivated after a full backup?
We have performed initial debugging steps, including deactivating WPML temporarily. When WPML is deactivated, the viewport tag issue is resolved, and Google PageSpeed Insights correctly detects the tag. However, when WPML is activated, the issue reappears, indicating a potential conflict.
I hope you're doing well. I have taken over this ticket and will do my best to assist you.
I have checked your site and can confirm that the Viewport meta tag is correctly added in the Head section. Therefore, PageSpeed Insights should not display the "Viewport missing" error.
However, if you believe the issue occurs only when the WPML plugin is active, please note that I tested a WPML-enabled site and the main WPML site itself, and PageSpeed Insights did not show any errors related to the Viewport.
While inspecting the WPML debug info, I found that the WPML and String Translation plugins are not updated to their latest versions. I also noticed that Yoast SEO is installed on your site, but the WPML SEO plugin, which is required to manage SEO information across different languages, is not active on your site. Could you please update both WPML and String Translation, activate the WPML SEO plugin, and then run the PageSpeed test again? Please ensure you clear the caches from your site before running the test.
Please let me know how it goes. I will be happy to help if you need further assistance in this matter.
I closely inspected your site again and found that the viewport tag is being defined within the <body> tag. This is why Pagespeed Insights is consistently showing it as an error. Please check the attached screenshot.
The viewport meta tag should always be in the <head> tag. However, if the header file in the theme, which contains the <head> tag, is incorrectly modified, you may encounter this issue.
To understand the root cause, could you please temporarily switch to a default theme like twenty twenty-one, keep the WPML plugin active, and check again?
If that resolves the issue, you should check the customizations made in your child theme. Specifically, if there is any header file containing the <head> tag, ensure that the viewport meta tag is correctly defined there. Additionally, check the file where the opening <body> tag is defined to ensure that the viewport meta tag is not included there.
Please check and let me know how it goes. I will be happy to help if you need further assistance in this matter.
Best regards,
Prosenjit
The topic ‘[Closed] There is an issue with the viewport tag on our website when using the WPML plugin.’ is closed to new replies.