Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:

You are developing a site using WP Job Manager and WPML and have encountered an issue where the application form in the job edit form displays in all languages instead of only the form of the current language.

Solution:

To resolve this issue, we recommend modifying the code to ensure the application form displays only in the current language. Please follow these steps after making a full site backup:

1) Navigate to the

wp-content/plugins/wp-job-manager-applications/includes/

folder.
2) Open the

wp-job-manager-applications-functions.php

file for editing.
3) Locate line 302.
4) Apply the following changes:

From

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 );
}

To

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 );
}

If this solution does not resolve your issue or seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please do not hesitate to open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 4 replies, has 0 voices.

Last updated by ericH-23 5 days, 22 hours ago.

Assisted by: Bigul.

Author Posts
January 3, 2025 at 1:03 pm #16561482

ericH-23

Background of the issue:
I am developing a site using WP Jobmanager and WPML. I created a new job with Jobmanager, and in the job edit form, I want to display the application form in the current language only.

Symptoms:
The application form in the job edit form shows in all languages instead of only the form of the current language.

Questions:
How can I display the application form in the current language only in the job edit form?

January 3, 2025 at 4:43 pm #16562098

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hi Eric,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

This is likely related to the ongoing compatibility issues we are experiencing with WP Job Manager and its add-ons.

Could you please confirm if it would be possible to reproduce the issue on the sandbox site we used for the previous tickets?

Test Site Login URL:- hidden link

If so, kindly provide the exact steps required to replicate the bug on the sandbox site.

--
Thanks!

Bigul

January 3, 2025 at 6:29 pm #16562371

ericH-23

Hi,
Thanks, is done.
Please visit hidden link and select a application form. See attached screenshot.
Thanks, kind regards
Eric

Bildschirmfoto 2025-01-03 um 19.28.13.png
January 6, 2025 at 5:46 pm #16567272

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hi Eric,

Thank you for providing the details and replicating the bug on the sandbox site. The issue is related to known problems with the WP Job Manager. We will investigate it further and get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

January 15, 2025 at 2:43 pm #16597788

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hi Eric,

It looks like the author wants to ensure the "Default form" is always available. The code reflects this in several ways like the following.

- The default form can't be deleted.
- They use 'suppress_filters = true' when retrieving all forms.
- They specifically check for the default form in the array.
- Their logic checks if there’s more than one form (since the default is always present).

A workaround might be possible. We are getting the expected results in the test site after the following steps. Please try it on your end after a full site backup and let us know your feedback. Also, please test in deep and update the plugin author about this.

1) Visit *wp-content/plugins/wp-job-manager-applications/includes/* folder
2) Open *wp-job-manager-applications-functions.php* file for editing
3) Scroll down to line *302*
4) Make the following changes and save the file

From

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 );
}

To

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 );
}

--
Thanks!

Bigul

January 15, 2025 at 10:12 pm #16599398

ericH-23

Hi,
Great, yes, this solved it.
Many thanks!
Eric