Blog

Oasis Workflow is compatible with WPML

Posted at 4:23 am on Oct 21, 2014

You can use the workflow features and the post/page revision features of Oasis Workflow in conjunction with WPML.

With WPML you can translate pages, posts, custom types, taxonomy, menus and even the theme’s texts. The WPML team provides full support, helping you deliver perfect websites on time.

In order to connect the revisions of translated pages with the original translated page, you can add the following custom code by implementing the ‘wpml_after_save_post’ hook.

add_action( 'wpml_after_save_post', function ($post_id, $trid, $language_code, $source_language) {

    $orig_id = apply_filters('wpml_object_id', $post_id, 'any', false, $source_language);
    if (!$orig_id) return;

    $oasis_original = get_post_meta($orig_id, '_oasis_original', true);
    if (!$oasis_original) return;

    $our_original = apply_filters('wpml_object_id', $oasis_original, 'any', false, $language_code);
    if (!$our_original) return;

    update_post_meta($our_original, '_oasis_current_revision', $post_id);
    update_post_meta($post_id, '_oasis_original', $our_original);

}, 11, 4 );

Oasis-Workflow-Pro-Plugin-certificate-of-WPML-compatibility