Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Polylang plugin customization WordPress

  • SOLVED

I'm using Polylang plugin for a multilingual site. (https://wordpress.org/plugins/polylang/)

I want to be able to “Hide URL language information for default language (which is an option in the plugin)” BUT for frontpage only and keep the language slug for other pages.

For example, my default language is AR.

But for inside pages it should be: http://www.site.com/ar/blog/post-name/ instead of http://www.site.com/blog/post-name/ (hiding the default lang slug)

Thanks in advance.

Answers (3)

2020-12-26

Bob answers:

Can you please provide your website url?


Hiro Hito comments:

Sorry Bob, I'm testing it locally.


Bob comments:

Okay.

I think there is no filter for available but modifying code of plugin itself might work.

there is function home_url and front_page_url in polylang plugin. simple condition in those function might work.


Hiro Hito comments:

I don't mind editing the code inside the plugin itself, can you tell me which file I can try this? an example would be appreciated.

2020-12-26

Monit Jadhav answers:

Go to settings in poly lang

click on setttings link under URL mofication,

Next tick the checkbox that says HIDE URL language information for default language and click save settings.

Please see the screenshot below, let me know if it solves your issue


Monit Jadhav comments:

Screenshot


Hiro Hito comments:

Hi Monit,

This option is actually enabled and what it does is, it hides the default lang slug sitewide instead of 'frontpage' only, which is what i want to achieve.


Monit Jadhav comments:

There must be some issues with the polylang setup can you try updating the plugin. Cause the option works exactly how it described in the settings.


Bob comments:

I think What he wants to do is show default language slug on pages other than home page right?


Hiro Hito comments:

@Bob, yes that is what I want.

2020-12-30

Mohamed Ahmed answers:

Hi Hiro,
This can be done but you must edit the core files of the plugin, and I don't recommend that.


Hiro Hito comments:

I don’t mind editing the core files, just want to know how it’s done.