Skip to content

Instantly share code, notes, and snippets.

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/8b247d56af0a2fac79fd414d9050adb5 to your computer and use it in GitHub Desktop.
Save Auke1810/8b247d56af0a2fac79fd414d9050adb5 to your computer and use it in GitHub Desktop.
If you want to override the Yoast default category to get the full category path of a product in the "product_type" attribute.
<?php
function wppfm_product_category_string_gets_full_category_path( $data, $feed_id, $product_id ) {
$data['product_type'] = WPPFM_Taxonomies::get_shop_categories( $product_id, ' > ' );
// Always return data!
return $data;
}
add_filter( 'wppfm_feed_item_value', 'wppfm_product_category_string_gets_full_category_path', 10, 3 );
@Auke1810
Copy link
Author

If you’re unfamiliar with filters in your wp-admin, the best and easiest way to do this is by using a plugin like “Code Snippets” (https://wordpress.org/plugins/code-snippets/). And here you can find a great video explaining the use of this plugin https://www.youtube.com/watch?v=I1_ZqnQmwJs.

​After activating the Code Snippets plugin you can use the code to add the functionality.

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