Automattic / Automattic/WP-Job-Manager

Duplicate job offer feature - issue with Polylang

Open
#2,291 6 comments 1 reaction 0 assignees View on GitHub
Customer Report
Dominant language
PHP
Stars
899
Forks
369
Avg merge
11h 37m
Merged PRs (30d)
12

Description

I run WP Job Manager with Polylang. To display all jobs in all language I duplicate the job offers and sync them with a custom function. This allows the users to modify their job offers in any language and making sure those changes are synced to the other languages as well.

When a job is synced with its translations some taxonomies are create by Polylang to link them together. The duplication of theses taxonomies to the new job offer also creates the issue/conflict with WP Job Manager duplication feature.

When duplicating a job offer WP Job Manager copies all available taxonomies, including the Polylang ones which will link the new job offer to the translations of the old job offer which just was duplicated. This is something that should not happen creating some issues with the translations and linking.

The file where the function is embedded is wp-job-manager-functions.php Line 1527-1535.

` $taxonomies = get_object_taxonomies( $post->post_type );
foreach ( $taxonomies as $taxonomy ) {
$post_terms = wp_get_object_terms( $post_id, $taxonomy, [ 'fields' => 'slugs' ] );
wp_set_object_terms( $new_post_id, $post_terms, $taxonomy, false );
}`

Is there an option to add a filter hook before foreach to remove certain taxonomies? Or limit the copying to only a certain type of taxonomies which are related to WP Job Manager only?

Thanks for your input. Best regards Lens

Contributor guide

Open the contributing guide

Research direction

Start in wp-job-manager-functions.php at lines 1527-1535 and inspect how taxonomies are copied during job duplication. Reproduce the conflict with Polylang and determine how a filter or taxonomy restriction should affect the loop. Done means duplicated offers no longer inherit Polylang translation taxonomies while WP Job Manager taxonomies continue to copy.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.