- 状态
- 未解决
- 相关插件/主题
- WP Job Manager
- 主题标签
- Compatibility
问题概述
将WP Job Manager与 WPML 搭配使用时,从前端(职位仪表板)删除职位文章或简历文章不会自动删除其翻译。即使在“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 ); }