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?!
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.
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