Skip to content

Instantly share code, notes, and snippets.

@bolderelements
Last active May 29, 2018 15:02
Show Gist options
  • Save bolderelements/d66763295d1fdc170f4781efb587c9e7 to your computer and use it in GitHub Desktop.
Save bolderelements/d66763295d1fdc170f4781efb587c9e7 to your computer and use it in GitHub Desktop.
Add IMG to Allowed Description Tags
/*
* Adds the <img> tag to allowed tags in the Description field.
*
* Requires Table Rate Shipping for WooCommerce 4.2+
*/
add_filter( 'betrs_desc_allowed_tags', 'add_new_allowed_tags_betrs', 10, 1 );
function add_new_allowed_tags_betrs( $allowedtags ) {
$allowedtags['img'] = array(
'alt' => true,
'align' => true,
'border' => true,
'height' => true,
'src' => true,
'width' => true,
'class' => true,
'id' => true,
'style' => true,
'title' => true,
);
return $allowedtags;
}
@ya-well
Copy link

ya-well commented May 29, 2018

Does this still work? Is it for displaying the likes of a courier logo beside the Shipping description at checkout? I've added to functions.php and tried to embed an image after the description text but the image doesn't appear and the HTML is stripped on saving

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment