Skip to content Skip to sidebar

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 2 replies, has 1 voice.

Last updated by Shekhar Bhandari 6 hours, 26 minutes ago.

Author Posts
March 24, 2026 at 2:23 pm #17922763

dennisB-32

It seems that my page does mirror 100% original language. If a page is changed from 'published' to 'draft' I want to to also mark the translated pages as draft.

Same for publish, delete, etc. But I think these might work. Why not draft?

March 24, 2026 at 3:22 pm #17922993

dennisB-32

Hello!
Will this work without causing any issues?

// --- WPML: Sync post status across all translations ---
// When a post/page/CPT in the default language changes status (publish, draft, trash, private, pending),
// all its translations are updated to match. Works for ALL post types with WPML translation enabled.
// Only syncs FROM the default language TO translations (not the reverse).
add_action('transition_post_status', function($new_status, $old_status, $post) {
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
if (wp_is_post_revision($post)) return;

static $syncing = false;
if ($syncing) return;

if ($new_status === $old_status) return;

if (!function_exists('apply_filters') || !has_filter('wpml_default_language')) return;

$default_lang = apply_filters('wpml_default_language', null);
$post_lang = apply_filters('wpml_post_language_details', null, $post->ID);
if (!$post_lang || $post_lang['language_code'] !== $default_lang) return;

$element_type = apply_filters('wpml_element_type', $post->post_type);
$trid = apply_filters('wpml_element_trid', null, $post->ID, $element_type);
if (!$trid) return;

$translations = apply_filters('wpml_get_element_translations', null, $trid, $element_type);
if (!$translations) return;

$syncing = true;
foreach ($translations as $lang => $translation) {
if ($lang === $default_lang) continue;
if (!isset($translation->element_id)) continue;

$trans_post = get_post($translation->element_id);
if (!$trans_post || $trans_post->post_status === $new_status) continue;

wp_update_post([
'ID' => $translation->element_id,
'post_status' => $new_status,
]);
}
$syncing = false;
}, 10, 3);

March 25, 2026 at 6:47 am #17924529

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello,

Thank you for reaching out to WPML support. Before your ticket is assigned to a supporter, I’d like to provide some guidance on your query.

Can you please check the solution provided here and see if it helps? hidden link

Let us know if these steps resolve the issue or if you need further assistance.

Thanks