Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
In order to accomplish it I took a few steps:
- Go to WPML > Languages > Edit languages
- Make sure Arabic uses encoded URLs
- Go to WPML > Settings > Translated documents options > Page URL
- Select 'Copy from original language if translation language uses encoded URLs' and save it
Now, the already translated pages, posts and products won't update right away, you need to make a minor edit to the original language post/product and save it so WPML sees the translation needs update. You can simply add an empty space anywhere in the post/page and save it, or do the change in bulk making a quick edit in the posts/products/pages listing screen.
After that, please check if the URL is already updated, if not, it might be necessary for you to edit the translation using the WPML advanced translation editor and save it.
I tested it for two products, only by making a small change(an extra empty space) to the main language product and saving it already applied the change to the secondary language, please check:
hidden link hidden link
Can you please review it and let me know if this is what you're looking to achieve?
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
I checked the product you shared and it looks like the URL is working properly
I went ahead and performed the steps for this other product as well: hidden link
I recorded a quick video demonstrating it:
hidden link
I'm afraid there's no built-in way to perform it in bulk for all posts, products, pages and other CPTs.
What you could try was to make a full backup of the site, especially the database and try to programmatically force an update of the posts with a code like this:
function force_wpml_url_update() {
// Get all posts, pages, and products
$post_types = array('post', 'page', 'product');
$args = array(
'post_type' => $post_types,
'post_status' => 'publish',
'posts_per_page' => -1,
);
$all_posts = get_posts($args);
foreach ($all_posts as $post) {
// Make a minor change to the content to force URL update
$post->post_content .= ' ';
wp_update_post($post);
}
}
add_action('admin_init', 'force_wpml_url_update');
The piece of code above will loop through your post, products and pages adding an empty space to the content and saving, the very same thing I performed in the video.
It is not guaranteed it would work, but in theory it should have the same effect. But it is extremely important that you have a backup in place first. After adding the code to the theme's functions.php file for example, you can open the wp-admin once and remove the code, it should be enough for it to run.
The topic ‘[Closed] Split: Use same URL/slug for translated items’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.