- 状态
- 等待作者
- 相关插件/主题
- WP Job Manager
- 主题标签
- Compatibility
问题概述
当将 WPML 与 WP Job Manager 的 Applications 附加组件一起使用时,职位仪表盘会错误地显示所有语言的申请表,而不是仅显示当前语言的表单。这会影响职位编辑表单并给用户造成困扰。
临时解决方法
在继续操作之前,请确保已对您的站点进行完整站点备份。
- 打开 …/\wp-content/plugins/wp-job-manager-applications/includes/wp-job-manager-applications-functions.php 文件。
- 找到第 302 行。
- 替换:
function get_application_forms() { $posts = new WP_Query( array( 'post_type' => 'job_application_form', 'posts_per_page' => - 1, 'suppress_filters' => true, 'orderby' => 'title', 'order' => 'ASC', ) ); $default_form = WP_Job_Manager_Applications_Default_Form::get_default_form(); if ( $posts->post_count <= 1 ) { return null; } $application_forms = []; if ( array_key_exists( 'ID', $default_form ) ) { $application_forms[ $default_form['ID'] ] = $default_form['post_title']; } foreach ( $posts->posts as $post ) { $application_forms[ $post->ID ] = $post->post_title; } return apply_filters( 'job_application_forms', $application_forms ); } - 替换为:
// WPML Workaround for compsupp-7797 function get_application_forms() { $posts = new WP_Query( array( 'post_type' => 'job_application_form', 'posts_per_page' => - 1, 'suppress_filters' => false, // replace true with false 'orderby' => 'title', 'order' => 'ASC', ) ); $default_form = WP_Job_Manager_Applications_Default_Form::get_default_form(); if ( $posts->post_count < 1 ) { // replace <= with < return null; } $application_forms = []; /* comment out this part if you don't want to see the default form in other languages if ( array_key_exists( 'ID', $default_form ) ) { $application_forms[ $default_form['ID'] ] = $default_form['post_title']; }*/ foreach ( $posts->posts as $post ) { $application_forms[ $post->ID ] = $post->post_title; } return apply_filters( 'job_application_forms', $application_forms ); }