- ステータス
- 未解決
- 関連するプラグイン/テーマ
- WP Job Manager
- トピックタグ
- Compatibility
問題の概要
WP Job ManagerをWPMLと併用している場合、フロントエンド(Job Dashboard)から求人投稿や履歴書投稿を削除しても、その翻訳は自動的には削除されません。「WPML > 設定 > 投稿とページの同期」で「投稿を削除する際、翻訳も削除する」オプションが有効化されている場合でも同様です。
回避策
続行する前に、サイトの完全なバックアップを取得していることを確認してください。
求人投稿の場合
- /wp-content/plugins/wp-job-manager/includes/class-job-dashboard-shortcode.phpを開きます
- 466行目を探します
- 次のコードを:
case 'delete': // Trash it. wp_trash_post( $job_id );
- 次のコードに置き換えます:
case 'delete': // Trash it. // WPML workaround for compsupp-7729 if ( class_exists('Sitepress') ) { $trid = apply_filters( 'wpml_element_trid', NULL, $job_id , 'post_job_listing' ); $translations = apply_filters( 'wpml_get_element_translations', NULL, $trid, 'job_listing' ); if ( !empty( $translations ) ) { foreach ( $translations as $lang => $translation ) { $translation_id = absint( $translation->element_id ); wp_trash_post( $translation_id ); } } } else { wp_trash_post( $job_id ); }
履歴書投稿の場合
- /wp-content/plugins/wp-job-manager-resumes/includes/class-wp-resume-manager-shortcodes.phpを開きます
- 125行目を探します
- 次のコードを:
case 'delete': // Trash it. wp_trash_post( $resume_id );
- 次のコードに置き換えます:
case 'delete': // Trash it. // WPML workaround for compsupp-7757 if ( class_exists('Sitepress') ) { $trid = apply_filters( 'wpml_element_trid', NULL, $resume_id , 'post_resume' ); $translations = apply_filters( 'wpml_get_element_translations', NULL, $trid, 'resume' ); if ( !empty( $translations ) ) { foreach ( $translations as $lang => $translation ) { $translation_id = absint( $translation->element_id ); wp_trash_post( $translation_id ); } } } else { wp_trash_post( $resume_id ); }