is_media_translated[ $post_id ] = ( count( pll_get_post_translations( $post_id ) ) > 1 ); } /** * Deletes the WP Offload Media information from the attachment being deleted. * That way WP Offload Media won't delete the file stored in the cloud. * Done after Polylang has deleted the translations information, to avoid the synchronization of the deletion * and of course before WP Offload Media deletes the file, normally at priority 20. * * @since 2.6 * * @param int $post_id Id of the attachment being deleted. */ public function prevent_file_deletion( $post_id ) { if ( ! empty( $this->is_media_translated[ $post_id ] ) ) { delete_post_meta( $post_id, 'amazonS3_info' ); delete_post_meta( $post_id, 'as3cf_filesize_total' ); } } }