Background of the issue:
I configured error URL format --Auto-generate from title (default), now I change it to Copy from original language if translation language uses encoded URLs. I want to change all webpage URL formats I have translated to the new URL format.
Symptoms:
No specific error message mentioned, but I need to change the URL format for translated pages.
Questions:
How do I change all webpage URL formats I have translated to the new URL format?
As if I understood this correctly, this should help resolve these changes with slugs.
But note that if this is about regenerating the translated slugs themselves after switching the URL format setting in WPML, Sticky Links won’t retroactively rebuild translated slugs to match the new format; it only updates internal links.
Now I want to confirm :
If URL format is "Copy from original language if translation language uses encoded URLs ",then if my english webpage address is hidden link , then jp webpage address will be hidden link ,right?
I dont want my url be translated.
If it is right, why I change URL format to "Copy from original language if translation language uses encoded URLs ",still all web url still is hidden link.
So I want to update all url format into new format like this hidden link.
Let me know if you think this is the same case (I think it is), because it is a rather complex issue which requires workaround in our code to make it work, because these slugs can be generated only once according to our code. So changing this later would not work without some changes, in particular this: https://wpml.org/forums/topic/bulk-translate-existing-pages-to-spanish-slugs-using-their-title/#post-17042792, so that the final code looks like the following:
// it's an update and user do not want to translate urls so do not change the url
if ( $element_id ) {
if ( $sitepress->get_setting( 'translated_document_page_url' ) !== 'translate' ) {
$postarr['post_name'] = $wpdb->get_var(
$wpdb->prepare(
"SELECT post_name
FROM {$wpdb->posts}
WHERE ID=%d
LIMIT 1",
$element_id
)
);
}
$existing_post = get_post( $element_id );
$postarr['post_date'] = $existing_post->post_date;
$postarr['post_date_gmt'] = $existing_post->post_date_gmt;
// Add your new condition here
if ( $sitepress->get_setting( 'translated_document_page_url' ) == "auto-generate" ) {
$postarr['post_name'] = sanitize_title_with_dashes(
$wpdb->get_var(
$wpdb->prepare(
"SELECT post_title
FROM {$wpdb->posts}
WHERE ID=%d
LIMIT 1",
$element_id
)
)
);
}
}
The topic ‘[Closed] I configure error URL format , Now how to I change all webpage url format I have translated.’ is closed to new replies.