Created
June 25, 2025 07:27
-
-
Save threadi/6f117483a7f38047266b6209fc22e199 to your computer and use it in GitHub Desktop.
Personio Integration: Mark all objects of given language during import as updated if WPML is used
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Personio Integration: Mark all objects of given language during import as updated if WPML is used. | |
* | |
* @param \PersonioIntegrationLight\PersonioIntegration\Import $import_obj The import object. | |
* | |
* @return void | |
*/ | |
function custom_personio_integration_mark_positions_as_updated( \PersonioIntegrationLight\PersonioIntegration\Import $import_obj ): void { | |
// get all positions for given Personio-URL. | |
$positions = \PersonioIntegrationLight\PersonioIntegration\Positions::get_instance()->get_positions( -1, array( 'lang' => $import_obj->get_language() ) ); | |
// set update-marker for these positions to prevent their deletion. | |
foreach ( $positions as $position ) { | |
// bail if title is empty (wrong language). | |
if( empty( $position->get_title() ) ) { | |
continue; | |
} | |
update_post_meta($position->get_id(), WP_PERSONIO_INTEGRATION_UPDATED, 1); | |
} | |
} | |
add_action( 'personio_integration_import_timestamp_no_changed', 'custom_personio_integration_mark_positions_as_updated' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment