Open Lens40 opened 2 years ago
Polylang is proposing the following adjustment:
`/**
$taxonomies = apply_filters( 'wpjm_filter_taxonomy_to_duplicate', 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 );
}`Allowing them to filter their translation taxonomies by adding a filter into their plugin:
add_filter( 'wpjm_filter_taxonomy_to_duplicate', 'filter_taxo' ); function filter_taxo( $taxonomies ){ $taxonomy_to_remove = array( 'post_translations' ); return array_diff( $taxonomies, $taxonomy_to_remove); }
Is this something you would consider for the next release?
@dadish @fjorgemota @onubrooks Could we please add a filter to the $taxonomy
and include it in 1.37.1? It will allow users to expand the Polylang/WPML (and other multilingual plugins) compatibility from their side as @Lens40 mentioned above.
Thanks Gino for supporting that :)
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