Skip to content

Instantly share code, notes, and snippets.

@threadi
Created June 25, 2025 07:27
Show Gist options
  • Save threadi/6f117483a7f38047266b6209fc22e199 to your computer and use it in GitHub Desktop.
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
/**
* 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