Last active
September 28, 2022 12:56
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.