Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsUtil::modify_product_review_moderation_urls │ public static │ WC 1.0

Modifies the moderation URLs in the email notifications for product reviews.

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

Хуков нет.

Возвращает

string. The modified email notification message.

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

$result = ReviewsUtil::modify_product_review_moderation_urls( $message, $comment_id );
$message(строка) (обязательный)
The email notification message.
$comment_id(int) (обязательный)
The comment ID.

Код ReviewsUtil::modify_product_review_moderation_urls() WC 11.2.2

public static function modify_product_review_moderation_urls( $message, $comment_id ) {
	$comment = get_comment( $comment_id );

	// Only modify URLs for product reviews.
	if ( ! $comment || get_post_type( $comment->comment_post_ID ) !== 'product' ) {
		return $message;
	}

	// Replace the WordPress comment moderation URLs with WooCommerce product review URLs.
	$product_reviews_url = admin_url( 'edit.php?post_type=product&page=product-reviews' );

	// Replace the moderation panel URL (this is the "show all reviews pending" link).
	$message = str_replace(
		admin_url( 'edit-comments.php?comment_status=moderated#wpbody-content' ),
		$product_reviews_url . '&comment_status=moderated',
		$message
	);

	return $message;
}