add_filter( 'wpml_exclude_packages_from_auto_translate', callable $function_to_add, 10, 3 );
Description
This filter lets you leave some string packages out of Translate Everything. Return the IDs of the packages to leave out.
WPML calls the filter once for each package kind. Return only the IDs of packages of that kind, so the list stays short. A package you return is left out for every target language.
The filter applies to the Translate Everything process and to its counts: the cost estimate and the number of items left to translate do not include the packages you leave out. It does not stop the automatic translation that starts when the strings of a package change. To control that, use the wpml_auto_translate_string_package filter.
Arguments
Callback Function Parameters
The callback function accepts three parameters:
$package_idsarrayThe IDs of the string packages to leave out. Default: an empty array.$kindstringThe package kind slug, in lower case, for examplewpformsorgravity_form.$languagesarrayThe codes of the target languages that WPML is about to process.
Example Usage
// Leave the packages of trashed forms out of Translate Everything. add_filter( 'wpml_exclude_packages_from_auto_translate', function( $package_ids, $kind, $languages ) { if ( 'my-form' !== $kind ) { return $package_ids; } return array_merge( $package_ids, my_plugin_get_trashed_form_package_ids() ); }, 10, 3 );