Skip to content

Instantly share code, notes, and snippets.

@Auke1810
Last active April 25, 2022 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Auke1810/f6627c1534781375a072a79a2bde0dff to your computer and use it in GitHub Desktop.
Save Auke1810/f6627c1534781375a072a79a2bde0dff to your computer and use it in GitHub Desktop.
remove all html tags from the description tag
<?php
function alter_feed_item( $attributes, $feed_id, $product_id ) {
// Strip html from description attributes
// allow given tags with allowedTags
$allowedTags = "";
$attributes['description'] = strip_tags($attributes['description'], $allowedTags);
// IMPORTANT! Always return the $attributes
return $attributes;
}
add_filter( 'wppfm_feed_item_value', 'alter_feed_item', 10, 3 );
@alhakeem2001
Copy link

Hello , where to add this code in order to remove all HTML codes from my product description?

@Auke1810
Copy link
Author

Hello @alhakeem2001, you add this code to your functions.php
Our plugin has a new function where you click the "edit values" link and select strip tags from the dropdown.
This will remove all HTML

@alhakeem2001
Copy link

Thanks Auke for your reply but what is the name of your plugin? because I couldn't find it when I wanted to add it!

@Auke1810
Copy link
Author

Ok, this function is a WordPress filter for our Product feed manager plugin.
There is no other use for this little snippet as for our feed manager you find at https://www.wpmarketingrobot.com/

@alhakeem2001
Copy link

I am using WP with WooCommerce, all what I need is to delete those HTML tags on my product descriptions. I don't think I need to download and install that plugin!

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