Skip to content

Instantly share code, notes, and snippets.

@Auke1810
Created February 14, 2019 15:14
Show Gist options
  • Select an option

  • Save Auke1810/827256dfbea142fbed119b892f463d10 to your computer and use it in GitHub Desktop.

Select an option

Save Auke1810/827256dfbea142fbed119b892f463d10 to your computer and use it in GitHub Desktop.
Remove multiple characters from feed
/**
* Alter Product feed item
* remove multiple characters from attribute
*/
function alter_feed_description_attribute( $attributes, $feed_id, $product_id ) {
global $product;
// Remove multiple characters from attribute
$remove = [",", ":", ";"];
$attributes['description'] = str_replace($remove, '', $attributes['description']);
// IMPORTANT! Always return the $attributes
return $attributes;
}
add_filter( 'wppfm_feed_item_value', 'alter_feed_description_attribute', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment