Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Andrey 3 months ago.

Assisted by: Andrey.

Author Posts
June 13, 2024 at 9:05 am #15735052

oliverG-51

1 - I have a custom wp-admin dashboard page (built with bricks builder) that includes some links in this format:
{site_url}/wp-admin/edit.php
Before WPML installed they got translated to:
hidden link

Now that WPML is installed {site_url} gets translated to the site_url / lang_code /
example:
hidden link

and this is now linking to 404 page not found.

Is there a way to exclude the language from been added to certain urls?

Or some other way I would avoid getting /en/ and /pt/ added to these links?
Via code snippet or something?

a) dont run wpml on certain pages
or
b) exclude certain urls from including language code
or some other better approach?!

June 13, 2024 at 2:06 pm #15736673

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I have conducted some tests locally using the default wp-admin dashboard page. WPML does not translate the site_url for admin pages; it only reads the values set for site_url in the wp_options table.

Your custom wp-admin dashboard page may call home_url instead of site_url, for example https://wpml.org/wpml-hook/wpml_home_url/. However, I am not sure how this affects the admin dashboard without proper debugging, which is beyond the scope of our support for custom things.

Or some other way I would avoid getting /en/ and /pt/ added to these links?
Via code snippet or something?

a) dont run wpml on certain pages
or
b) exclude certain urls from including language code
or some other better approach?!

To avoid this issue, first, you need to find out why a language code appears in the admin URL when there is no language code for the default wp-admin dashboard page.

It's not possible to disable WPML for particular pages. Also, existing settings don't allow you to exclude a language code. You might be able to set up some custom redirects instead.

June 14, 2024 at 8:32 am #15738830

oliverG-51

Hi Andrey.
So I found out why a language code appears in the dashboard.

For context:
I have a custom wp-admin dashboard page I created in bricks builder. Its a simple page with a pretty background and with some buttons and links.

Those links are dynamic (not hard coded) so I don't have to reset them on every site I build or when the domain changes.

The links are set like so: {site_url}/wp-admin/edit.php
Image attached

To actually load the custom dashboard page inside wp-admin I use another plugin.

Inside this plugin, to set the custom dashboard there is only one option, where you provide the slug of the page you want to load has the dashboard: (image attached)

That custom page/slug after gets loaded in a iframe inside the wp-admin dashboard.

In other words, the custom dashboard page is a "normal" page accessible via front end of the site, that gets loaded inside the wp-admin.
Because its a "normal" page with just buttons and links there is no security risk.

My guess is that because its a "front end" page {site_url} from bricks gets translated to my_url/en/ and that is causing the issue I have.

So I fixed my issue by replacing the dynamic_data filed:
{site_url}/wp-admin/edit.php
With:
{echo:site_url()}/wp-admin/edit.php

Hope it helps others too.

Screenshot 2024-06-14 at 07-53-44 WP Admin Cleaner — WCMS06.png
Screenshot 2024-06-14 at 07-42-14 Dashboard V1 (Builder).png
June 17, 2024 at 10:49 am #15744797

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Hello,

Thank you for the explanation. I am glad to hear that you have found the solution.

Have a nice week!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.