WC_Post_Types::updated_term_messages()public staticWC 4.4.0

Customize taxonomies update messages.

Метод класса: WC_Post_Types{}

Хуков нет.

Возвращает

true|false.

Использование

$result = WC_Post_Types::updated_term_messages( $messages );
$messages(массив) (обязательный)
The list of available messages.

Список изменений

С версии 4.4.0 Введена.

Код WC_Post_Types::updated_term_messages() WC 8.7.0

public static function updated_term_messages( $messages ) {
	$messages['product_cat'] = array(
		0 => '',
		1 => __( 'Category added.', 'woocommerce' ),
		2 => __( 'Category deleted.', 'woocommerce' ),
		3 => __( 'Category updated.', 'woocommerce' ),
		4 => __( 'Category not added.', 'woocommerce' ),
		5 => __( 'Category not updated.', 'woocommerce' ),
		6 => __( 'Categories deleted.', 'woocommerce' ),
	);

	$messages['product_tag'] = array(
		0 => '',
		1 => __( 'Tag added.', 'woocommerce' ),
		2 => __( 'Tag deleted.', 'woocommerce' ),
		3 => __( 'Tag updated.', 'woocommerce' ),
		4 => __( 'Tag not added.', 'woocommerce' ),
		5 => __( 'Tag not updated.', 'woocommerce' ),
		6 => __( 'Tags deleted.', 'woocommerce' ),
	);

	$wc_product_attributes = array();
	$attribute_taxonomies  = wc_get_attribute_taxonomies();

	if ( $attribute_taxonomies ) {
		foreach ( $attribute_taxonomies as $tax ) {
			$name = wc_attribute_taxonomy_name( $tax->attribute_name );

			if ( $name ) {
				$label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name;

				$messages[ $name ] = array(
					0 => '',
					/* translators: %s: taxonomy label */
					1 => sprintf( _x( '%s added', 'taxonomy term messages', 'woocommerce' ), $label ),
					/* translators: %s: taxonomy label */
					2 => sprintf( _x( '%s deleted', 'taxonomy term messages', 'woocommerce' ), $label ),
					/* translators: %s: taxonomy label */
					3 => sprintf( _x( '%s updated', 'taxonomy term messages', 'woocommerce' ), $label ),
					/* translators: %s: taxonomy label */
					4 => sprintf( _x( '%s not added', 'taxonomy term messages', 'woocommerce' ), $label ),
					/* translators: %s: taxonomy label */
					5 => sprintf( _x( '%s not updated', 'taxonomy term messages', 'woocommerce' ), $label ),
					/* translators: %s: taxonomy label */
					6 => sprintf( _x( '%s deleted', 'taxonomy term messages', 'woocommerce' ), $label ),
				);
			}
		}
	}

	return $messages;
}