- availability:
-
WPML Version: 2.2
- description:
-
Deletes a string translation package*. When this action is called, all the data related to the package is deleted: package, strings, strings translations and jobs.
*String translation packages are registered with wpml_register_string and their translations retrieved with wpml_translate_string
Note: This hook requires the WPML String Translation module
- type:
- action
- category:
- Inserting Content
- parameters:
-
do_action( 'wpml_delete_package', string $package_name, string $package_kind )
- $package_name
- (string) (Required) The unique name of the package as it was registered with wpml_register_string
- $package_kind
- (string) (Required) The package kind as used when it was registered using wpml_register_string
- hook example usage:
-
Example using Layouts
add_action( 'before_delete_post', 'my_deleted_post' ); function my_deleted_post( $post_id ) { $is_a_layout_delete_action = isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'delete_layout_record'; $layout_ids_to_delete = isset( $_POST[ 'layout_id' ] ) ? (array)$_POST[ 'layout_id' ] : array(); if ( $is_a_layout_delete_action && in_array($post_id, $layout_ids_to_delete) ) { $package_name = $post_id; $package_kind = 'layout'; do_action( 'wpml_delete_package', $package_name, $package_kind ); } }