Translate the blog name and description with Polylang

The first filter, applied to option_blogdescription, dynamically translates the WordPress blog description based on the current Polylang language, ensuring the appropriate translation is displayed on the frontend while leaving the admin area unaffected; it achieves this by checking the active language via pll_current_language() and substituting the default description with a predefined translation if available, falling back to the original description otherwise.

The second filter, targeting option_blogname, modifies the blog name by appending a language-specific suffix when viewed on the frontend by logged-in users, utilizing Polylang’s language detection to customize the output for supported languages, while also preserving the original name in unsupported scenarios or within the admin area.

Frontend // Blog Description translation

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top