Nutrition
Percent Daily Value Calculations
Each nutritional item (Fat, Saturated Fat, etc.) has its own unique daily value calculation. This value is set to American standards by default, but this number varies in different parts of the world. You can customize these values with some simple filters.
All Available Filters:
- Total Fat
cooked_pdv_fat
Default: 65 - Saturated Fat
cooked_pdv_satfat
Default: 65 - Cholesterol
cooked_pdv_cholesterol
Default: 300 - Sodium
cooked_pdv_sodium
Default: 2400 - Potassium
cooked_pdv_potassium
Default: 3500 - Total Carbohydrates
cooked_pdv_carbs
Default: 300 - Fiber
cooked_pdv_fiber
Default: 25 - Protein
cooked_pdv_protein
Default: 50
Example — Custom Plugin with Adjustments
Download the Sample Plugin
<?php /* Plugin Name: Cooked Nutrition Customizations Description: This plugin customizes some of the nutrition calculations. Version: 1.0.0 Author: Boxy Studio */ // Protein Customization (90g) add_filter( 'cooked_pdv_protein', 'custom_cooked_pdv_protein', 10, 1 ); function custom_cooked_pdv_protein( $value ){ return 90; } // Carbs Customization (20g) add_filter( 'cooked_pdv_carbs', 'custom_cooked_pdv_carbs', 10, 1 ); function custom_cooked_pdv_carbs( $value ){ return 20; } // Fat Customization (173g) add_filter( 'cooked_pdv_fat', 'custom_cooked_pdv_fat', 10, 1 ); function custom_cooked_pdv_fat( $value ){ return 173; } ?>