WC_Admin_Post_Types::post_updated_messages()publicWC 1.0

Change messages when a post type is updated.

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

Хуков нет.

Возвращает

Массив.

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

$WC_Admin_Post_Types = new WC_Admin_Post_Types();
$WC_Admin_Post_Types->post_updated_messages( $messages );
$messages(массив) (обязательный)
Array of messages.

Код WC_Admin_Post_Types::post_updated_messages() WC 9.4.2

public function post_updated_messages( $messages ) {
	global $post;

	$messages['product'] = array(
		0  => '', // Unused. Messages start at index 1.
		/* translators: %1$s: Product link opening tag. %2$s: Product link closing tag.*/
		1  => sprintf( __( 'Product updated. %1$sView Product%2$s', 'woocommerce' ), '<a id="woocommerce-product-updated-message-view-product__link" href="' . esc_url( get_permalink( $post->ID ) ) . '">', '</a>' ),
		2  => __( 'Custom field updated.', 'woocommerce' ),
		3  => __( 'Custom field deleted.', 'woocommerce' ),
		4  => __( 'Product updated.', 'woocommerce' ),
		5  => __( 'Revision restored.', 'woocommerce' ),
		/* translators: %1$s: Product link opening tag. %2$s: Product link closing tag.*/
		6  => sprintf( __( 'Product published. %1$sView Product%2$s', 'woocommerce' ), '<a id="woocommerce-product-updated-message-view-product__link" href="' . esc_url( get_permalink( $post->ID ) ) . '">', '</a>' ),
		7  => __( 'Product saved.', 'woocommerce' ),
		/* translators: %s: product url */
		8  => sprintf( __( 'Product submitted. <a target="_blank" href="%s">Preview product</a>', 'woocommerce' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
		9  => sprintf(
			/* translators: 1: date 2: product url */
			__( 'Product scheduled for: %1$s. <a target="_blank" href="%2$s">Preview product</a>', 'woocommerce' ),
			'<strong>' . date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ) . '</strong>',
			esc_url( get_permalink( $post->ID ) )
		),
		/* translators: %s: product url */
		10 => sprintf( __( 'Product draft updated. <a target="_blank" href="%s">Preview product</a>', 'woocommerce' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
	);

	$messages = $this->order_updated_messages( $messages );

	$messages['shop_coupon'] = array(
		0  => '', // Unused. Messages start at index 1.
		1  => __( 'Coupon updated.', 'woocommerce' ),
		2  => __( 'Custom field updated.', 'woocommerce' ),
		3  => __( 'Custom field deleted.', 'woocommerce' ),
		4  => __( 'Coupon updated.', 'woocommerce' ),
		5  => __( 'Revision restored.', 'woocommerce' ),
		6  => __( 'Coupon updated.', 'woocommerce' ),
		7  => __( 'Coupon saved.', 'woocommerce' ),
		8  => __( 'Coupon submitted.', 'woocommerce' ),
		9  => sprintf(
			/* translators: %s: date */
			__( 'Coupon scheduled for: %s.', 'woocommerce' ),
			'<strong>' . date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ) . '</strong>'
		),
		10 => __( 'Coupon draft updated.', 'woocommerce' ),
	);

	return $messages;
}