Skip to content

Recipe Settings

Armand Tresova edited this page Apr 30, 2024 · 2 revisions

'cooked_single_recipe_settings'
This filter is applied when getting all of the settings for a single recipe. If you need to load or set your own here, this is the time to do it.

Example:

add_filter( 'cooked_single_recipe_settings', 'custom_cooked_single_recipe_settings', 10, 2 );
function custom_cooked_single_recipe_settings( $recipe_settings, $recipe_id ){

    // You can use the $recipe_id to get post data.
    $custom_variable = get_post_meta( $recipe_id, 'custom_post_meta', true );

    // Then you can apply whatever you need to, to the $recipe_settings variable.
    $recipe_settings['custom_variable'] = $custom_variable;

    // Then, just return it:
    return $recipe_settings;

}