WPML disable 同步翻譯文章的 update & publish / save draft 按鈕

WPML 版本 WPML Multilingual CMS 4.8.4

會發現被標記為「複製」(非獨立翻譯)的文章,在有「獨立翻譯」的按鈕狀態下,應該要將 update & publish / save draft 按鈕 disabled,避免奇怪的彈窗操作。

/res/js/post-edit.js 在 282 行開始加入

  if (is_duplicate_post) {
    // disable the save draft button
    $( '#save-post' ).prop( 'disabled', true )
    // disable the publish button
    $( '#publish' ).prop( 'disabled', true )

        // add hint before poststuff
    setTimeout( function () {
      $( '#poststuff' ).prepend( '<div class="notice notice-warning" style="color: red;"><p>目前此項目與原語系同步中,請先點選「獨立翻譯 (Translate independently)」後再進行修改,否則無法存檔!</p></div>' )
    }, 1000 )
  }