We would like to include the country/language ISO code to the very end of the meta title tag of every page on our site.
With Yoast, we're able to use "Yoast variables" to insert things like %title% or even the ACF plugin allows us to insert ACF fields into the Yoast meta title setting using a similar method.
Is there a way to add WPML language/locale ISO codes into the Yoast meta title?
After reviewing your requirements, I'd like to inform you that Yoast SEO or WPML, by default, does not offer a direct method to dynamically insert WPML language or locale codes into the meta titles using its built-in variables, such as the ones you mentioned (%title%).
By taking a custom coding approach, you should be able to achieve what you're looking for. But please be informed that providing support for custom coding falls outside our standard support scope. That said, we're more than happy to point you in the right direction and ensure you have the information needed to move forward.
Yoast SEO allows for the insertion of custom fields into the meta title through its snippet variables functionality, as detailed in their guide here: hidden link. Using this feature, you can create a custom field that stores the current language code, and then reference this custom field in your Yoast meta title settings.
To obtain the current language code, you may use the `wpml_current_language` hook of WPML. For more details on how to use this hook, please refer to the following link: https://wpml.org/wpml-hook/wpml_current_language/. Additionally, WPML's Hook Guide might offer further insights or alternative approaches that could be beneficial for your specific needs. You can explore the guide here: https://wpml.org/wpml-hook/.
However, if you need hands-on assistance with custom coding, we recommend consulting with a certified developer. WPML has a list of reputable contractors who are well-versed in such customizations, which you can find here: https://wpml.org/contractors/.
I understand the technical nature of this solution and appreciate your understanding regarding the support limitations. If you have any more questions or require further guidance within the support scope, please don't hesitate to reach out. I'll be happy to help.
Best regards,
Prosenjit
The topic ‘[Closed] How to add the country/language ISO code to the meta title sitewide with Yoast’ is closed to new replies.