Skip to content

Filter hook 'woocommerce_thankyou_order_received_text' is escaping HTML #40352

@YordanSoares

Description

@YordanSoares

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

After merging #39758, any HTML passed though the woocommerce_thankyou_order_received_text filter hook is being escaped:

Expected behavior

Before merging #39758, it was possible to pass HTML code through this filter. This is very useful to add links or any other HTML code. This HTML code should be rendered correctly.

Actual behavior

Any HTML passed though the 'woocommerce_thankyou_order_received_text' filter hook is being escaped:

Steps to reproduce

  1. Activate this code snippet in your site:
add_filter('woocommerce_thankyou_order_received_text', 'wc_test_thank_you_link', 10, 2);
function wc_test_thank_you_link( $text, $order ) {
    $text .= '<p><a href="https://example.com">Click here</a></p>';
    return $text;
}
  1. Place a new order and check the code displayed after "Thank you. Your order has been received.", which should look like this:

    image

WordPress Environment

WordPress address (URL): https://woocommerce-testing.local
Site address (URL): https:///woocommerce-testing.local
WC Version: 8.1.1
REST API Version: ✔ 8.1.1
WC Blocks Version: ✔ 10.9.3
Action Scheduler Version: ✔ 3.6.2
Log Directory Writable: ✔
WP Version: 6.3.1
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
External object cache: –

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions